-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Make sure to deal with malformed UTF-8 in file names #374
Make sure to deal with malformed UTF-8 in file names #374
Conversation
Review changes with SemanticDiff. Analyzed 2 of 2 files. Overall, the semantic diff is 22% smaller than the GitHub diff.
|
This seems to have improved the performance of large directory slightly, around 2%. |
Another observation: with this change symlinks show up with the size of the linked file which is correct IMHO. Previously it was the size of the symlink which makes little sense given that the file is otherwise not indicated as a symlink. The MIME type is being derived from the file name of the symlink however, not the linked file. I wonder whether that is the right thing to do here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just minor comments to check.
Good question, yeah the symlink name could differ from the actual linked file but I do not if we should follow the symlink to that point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to delay the PR.
Thanks!
Description
This streamlines the logic in directory listings as discussed. It also makes sure to operate with file names as
OsString
, allowing for invalid Unicode in file names. The (potentially lossy) conversion to string only happens when the name needs to be displayed. Quite a few unnecessary error conditions got removed as a side-effect.Something to consider would be enabling serialization of the
uri
field in JSON. Since thename
field might have lost information, there is currently no reliable way to deduce the file’s URL from the JSON data.Related Issue
#371
How Has This Been Tested?
On the Linux command line I did:
I verified that both the directory and the file show up in the listing (with the Unicode placeholder showing up for
\x80
) and both can be opened. The filetext.txt
in the directory can be opened as well.As to Windows, I’m not sure that creating a file with a non-Unicode name is even possible. I did verify that the fallback employed there works on Linux (for properly encoded file names) but I didn’t perform any testing on Windows.