-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: If a folder is soft link, it will be treated as a file and not a folder #1694
Comments
|
Noticed more of my folders were also bugged and I don't use CMD. Doesn't matter if we dont use cmd, other scripts/programs will eventually use it like the .config folder. Golang os package literally wont return the bits for CMD made symlinks from fileInfo.Mode all it returns is read perm bits. EDIT: nevermind, fixed it. |
windows symlinks are strange and they are not treated as directories in go, so using just fileInfo.Dir isn't enough.
closing as we're about to release 0.11. Thank you @Jalileh for fixing this!! |
|
@abgox what utility do you use to make your symlinks? Could you provide reproduction steps? |
Yeah sorry, the bug here is in the dot of the symlink folder name ( .config ) isFileSymlink := func(filepath string) bool {
Length := len(filepath) - 1
maxFileDotExt := 4 // should cover most file extensions
for i := Length; i >= (Length - maxFileDotExt); i-- {
if filepath[i] == '.' {
return true
}
}
return false
} isFileSymlink := func(filepath string) bool {
+ if len(filepath) == 0 {
+ return false
+ }
+ return strings.LastIndex(filepath, ".") > strings.LastIndex(filepath, "/")
} |
|
fixing this right now and realize the AI refractor doesnt even improve upon my method, this line literally does nothing return strings.LastIndex(filepath, ".") > strings.LastIndex(filepath, "/"), I'm going to open a PR and revert back to the one I wrote before and hopefully make it less linear and unreliable so AI dosen't suggest anything worse again. Soz! |
Current Behavior
Expected Behavior
They should be correctly recognized as a folder.
Steps To Reproduce
When you use
File Preview
to browse a file directory, this error occurs whenever a folder in the directory is soft link.Wave Version
0.10.4
Platform
Windows
OS Version/Distribution
Windows 11
Architecture
x64
Anything else?
No response
Questionnaire
The text was updated successfully, but these errors were encountered: