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>
Moving or copying a folder to SMB failed half-way when a name inside contained a character SMB does not allow, and the files copied so far stayed in the target. Checking the whole tree first lets the operation fail before anything is copied. Creating, uploading or renaming to such a name is rejected up front for the same reason. With these checks in place, looking up such a path can report it as missing instead of throwing. Signed-off-by: Tom Mittelstädt <1583407+1358@users.noreply.github.com>
3 of 8 tasks
1358
marked this pull request as ready for review
December 4, 2026 07:35
1358
requested review from
GhassenKefi,
icewind1991,
provokateurin and
vlotysh
and removed request for
a team
December 4, 2026 07:35
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
Follow-up to #67678. Moving or copying a folder to SMB external storage failed half-way when a name inside contains a character SMB does not allow, and the files copied so far stayed in the target. Now:
SMB::copyFromStorage()checks all names of the source tree before anything is copied. The move or copy fails with 400 and nothing is created on the share. The message names the path, e.g.event/sub/14:15.mp4: ":" is not allowed inside a file or folder name.SMB::verifyPath()rejects such names up front for uploads (including chunked), new folders and renames, with the existing message for forbidden characters.SMB::getFileInfo()maps icewind'sInvalidPathExceptionto not found. I left that out of fix: report invalid SMB names on cross-storage move/copy instead of a 500 #67678 because without the checks above it made a direct upload fail later and without the file name.The tree check only looks at the characters SMB can't store, not at the filename rules of the instance, so files with names the instance no longer allows can still be moved as before. It lists the source tree once more before copying, which is cheap compared to copying the data.
The characters are the ones icewind/smb enforces. icewind has no getter for them, so they are copied into a constant. The list hasn't changed since 2015, and a test fails if it ever differs from icewind's.
No new strings: the message reuses the one of the filename validator, so this could be backported as well.
How to test
a.txt,sub/14:15.mp4andz.txtonto the SMB mount: HTTP 400, the toast says<folder>/sub/14:15.mp4: ":" is not allowed inside a file or folder name., nothing is created on the share.14:15.mp4, create a foldera:bor rename a file toa:b.txt. Each is rejected with HTTP 400 and":" is not allowed inside a file or folder name.TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)