Skip to content

TUS upload of new files with backslashes in filename fails with 412 Precondition Failed, but rename to backslash succeeds #2803

Closed

Description

@Xardas220

Environment:
OpenCloud Server in Docker 4.0.7
OpenCloud Desktop Client 3.0.3.2073
macOS client
TUS upload enabled

Steps to reproduce:

  1. Create a local file with a backslash in its filename, e.g.
    DICOM\PA000001\ST000001\SE000007\IM000024
  2. Let OpenCloud Desktop Client sync it.
  3. Observe TUS POST:
    POST /dav/spaces/$
  4. Server returns 412 Precondition Failed.
  5. File is added to client blacklist.
  6. Rename the file so backslashes become slashes.
  7. Client uploads it; server shows colons instead (behavior of MacOS: Slash is shown in Finder but on data level slashes are colons).
  8. Rename the already uploaded file back to backslashes.
  9. Rename sync succeeds and file is visible in Web UI with backslashes and is syncing correctly.

Expected:
Either new files with backslashes upload successfully via TUS, or the desktop client rejects them before upload with a clear unsupported-character message.

Actual:
Initial TUS upload fails with 412 Precondition Failed, but subsequent rename to the same backslash-containing name succeeds.

Setup:
Server is started via docker compose. It's standard compose file provided online.

If additional details are needed I can give it. Feel free to reach out.

Activity

  1. michaelstingl commented on May 31, 2026

    @michaelstingl
    Contributor

    Tested on a current build (OpenCloud 6.1.0, reva v2.46.x) with the desktop client 3.0.3, the web UI, and curl. The two symptoms in the title have separate causes.

    The backslash rejection itself is configured policy

    The ocdav name validation forbids a configured set of characters. The default set includes the backslash, alongside \f, \r, \n (reva, internal/http/services/owncloud/ocdav/config, NameValidation.InvalidChars). The validation therefore rejects any new file whose name contains \ on upload.

    The create-vs-rename asymmetry is version-specific and already addressed

    OpenCloud 4.0.7 vendors reva v2.40.4, which does not include:

    That change added the same name validation to the MOVE and MKCOL handlers. On v2.40.4 the rename (MOVE) path did not validate the destination name. Renaming an already-uploaded file to a backslash name then succeeded and stored a literal backslash, which the web UI showed. On a current build the create (TUS) and the rename (MOVE) reject \ consistently, so the "rename succeeds" asymmetry no longer reproduces.

    Consistent rejection on a current build:

    # TUS create, filename carries a backslash (base64 in Upload-Metadata)
    POST /dav/spaces/<spaceID>     Upload-Metadata: filename <base64 of "...IM\000024">
      -> 412 Precondition Failed, empty body
    
    # same name without the backslash
    PUT  /dav/spaces/<spaceID>/...IM000024
      -> 201 Created
    
    # MOVE an existing file onto a backslash name (raw "\" and percent-encoded %5C)
    MOVE /dav/spaces/<spaceID>/clean   Destination: .../...IM\000024
      -> 400 Bad Request ("destination naming rules")
    

    The remaining issue: the TUS create path reports the rejection differently from the other write handlers

    On the same name-validation failure, put.go, move.go, copy.go, and mkcol.go return 400 Bad Request with a message (via errors.Marshal). The TUS POST handler (tus.go, the ValidateName branch, current main) returns a bare 412 Precondition Failed with no body.

    With no body, and a status that does not point to a naming problem, clients cannot tell the user why. The desktop client shows an empty "server replied:" and blacklists the file, with no usable message and no recovery until the name changes. The web UI shows "Unbekannter Fehler" with only an X-Request-Id. The 412 ("Precondition Failed") also reads as a protocol or header precondition rather than an invalid name.

    🤖 drafted with Claude Code, reviewed before submitting.

  2. michaelstingl commented on May 31, 2026

    @michaelstingl
    Contributor

    Filed the backend part (the TUS create path returning a bare 412 on an invalid name, where the other write handlers return 400 with a message) as a separate reva issue:

    🤖 drafted with Claude Code, reviewed before submitting.

  3. rhafer commented on Jun 25, 2026

    @rhafer
    Member
  4. moved this from Qualification to Done in OpenCloud Team Boardon Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions