Repository navigation
Conversation
When writing a file to the target storage fails, copyFromStorage() deletes the partially written target. If that unlink() throws as well, the exception escapes the folder traversal and the move or copy ends in an HTTP 500. A target name the storage cannot store must still reach the client, so it can tell which file failed, as it already does when the top-level target name is invalid. Signed-off-by: Tom Mittelstädt <1583407+1358@users.noreply.github.com>
icewind/smb throws its own InvalidPathException for names containing characters SMB does not allow, e.g. ":". fopen() let it escape unmapped, and unlink() threw for a path that cannot exist on the share. Signed-off-by: Tom Mittelstädt <1583407+1358@users.noreply.github.com>
2 of 8 tasks
1358
marked this pull request as ready for review
December 4, 2026 07:33
1358
requested review from
Altahrim,
GhassenKefi,
salmart-dev and
vlotysh
and removed request for
a team
December 4, 2026 07:33
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moving a folder to SMB external storage fails with an HTTP 500 when a file inside has a name SMB can't store, e.g.
14:15.mp4. This is the defensive part from #65715, kept separate from the path pre-validation so it can be backported:Common::copyFromStorage()no longer lets a failing cleanup of the partially written target abort the traversal.InvalidPathExceptionfrom writing the target is rethrown after the cleanup. DAV MOVE and COPY answer it with 400 Invalid Path, as they already do for an invalid top-level name.fopen()maps icewind'sInvalidPathExceptiontoOCP\Files\InvalidPathException, andunlink()returns false for such a path.Before, the client got the exception of the failed cleanup as a 500. Guarding the cleanup alone would turn that into an empty 403, and the Files app would only show "Some files could not be moved". Now the toast names the file and the character, and there is no "Uncaught exception" in the log anymore.
Not fixed here: the files copied before the failing one stay in the target. #67680 validates the tree against the SMB backend before copying.
I left out mapping
InvalidPathExceptioninSMB::getFileInfo(). On its own it lets a direct upload of14:15.mp4to SMB get pastfile_exists()and fail when the part file is renamed, which swallows the exception. The client then gets "Could not rename part file to final file" instead of the file name. With the pre-validation that path isn't reached anymore, so the mapping is part of #67680.The commits apply cleanly to stable35, stable34 and stable33.
How to test
ghcr.io/servercontainers/sambaas in the files-external CI job.a.txt,14:15.mp4andz.txtand move it onto the SMB mount in the Files app.Invalid request for Invalid path "/<folder>/14:15.mp4", ":" is not allowed (InvalidPathException). The source folder stays complete.TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)