Skip to content

fix: negate followLinks flag for checkSymlinkState#843

Merged
tomaswolf merged 1 commit into
apache:masterfrom
bemoty:master
Oct 18, 2025
Merged

fix: negate followLinks flag for checkSymlinkState#843
tomaswolf merged 1 commit into
apache:masterfrom
bemoty:master

Conversation

@bemoty
Copy link
Copy Markdown
Contributor

@bemoty bemoty commented Oct 16, 2025

I'm using sshd-sftp as a custom SFTP server for its great virtual file system capabilities (it allows me to easily create a virtual space for each user). Each user directory contains symlinks (essentially "shares") to folders outside of the virtual file system.

After upgrading to 2.16.0 I noticed that file deletion did not work anymore. It kept giving me a NoSuchFileException "Removal candidate not found".

In doRemoveFile it seems like followLinks is missing a ! before being passed to checkSymlinkState. This was done correctly in other methods such as doRemoveDirectory.

@tomaswolf
Copy link
Copy Markdown
Member

Good catch!

Looking through the callers of checkSymlinkState it appears that it is also wrong at

return resolveFileAttributes(file, flags, followLinks, options);

Can we also add tests for this (at least on Unix-like platforms, where we have symlinks)?

@bemoty
Copy link
Copy Markdown
Contributor Author

bemoty commented Oct 17, 2025

I gave it a try! Not sure if this was the right place for them though... let me know if you need me to move something. I created one test case for each checkSymlinkState caller, and excluded Win32 from the tests.

@tomaswolf tomaswolf merged commit 794122f into apache:master Oct 18, 2025
7 checks passed
@tomaswolf
Copy link
Copy Markdown
Member

Thanks a lot for the fixes and tests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants