Skip to content
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

Cannot receive files with characters not allowed on Windows #86

Closed
Alphastaire opened this issue Aug 6, 2024 · 4 comments · Fixed by #93
Closed

Cannot receive files with characters not allowed on Windows #86

Alphastaire opened this issue Aug 6, 2024 · 4 comments · Fixed by #93
Assignees
Labels
bug Something isn't working

Comments

@Alphastaire
Copy link

Windows file names cannot contain certain characters: \/:*?"<>|
Files with these characters sent to users on Windows fail to transfer.

In order for Windows users to be able to receive these files, the file names must be sanitized when saved by Dino+ to local storage.

@mxlgv
Copy link
Owner

mxlgv commented Aug 8, 2024

@Alphastaire To be honest, it is not entirely clear how to fix this gracefully. Because it rather depends not on the OS, but on the file system. Yes, you can really check the file name for Windows for prohibited symbols, and for a prohibited name like "con" (a wonderful legacy of MSDOS). But it would be great if the file system itself said that "a file with such a name cannot be saved." In general, the second option is preferable. After handling such an exception, a new file name can be generated.

@Alphastaire
Copy link
Author

@Alphastaire To be honest, it is not entirely clear how to fix this gracefully. Because it rather depends not on the OS, but on the file system. Yes, you can really check the file name for Windows for prohibited symbols, and for a prohibited name like "con" (a wonderful legacy of MSDOS). But it would be great if the file system itself said that "a file with such a name cannot be saved." In general, the second option is preferable. After handling such an exception, a new file name can be generated.

Yeah... it's not exactly the most graceful solution. I'm not fond of it myself. It's ugly. It's just the most common solution that I see other clients such as Gajim implement. I do agree something like that second option would be better, as it could notify the user of the file's original name. Gajim does some very aggressive automatic file name stripping (completely cutting off a file name if it encounters a prohibited symbol), which isn't very nice in my experience. My friend is constantly sending me images with such file names, and he has to tell me what they're originally named if we're using Gajim.

@Alphastaire
Copy link
Author

Alphastaire commented Aug 8, 2024

My thought for a comprehensive solution: internally save received files to local storage using an entirely different file name (the checksum for example, which could also allow for deduplication if that's desired), while still displaying the intended file name to the user.

EDIT: Nevermind, deduplication is a bit too much feature creep for this issue. Maybe later.

@mxlgv
Copy link
Owner

mxlgv commented Aug 9, 2024

@Alphastaire I thought that I could do this using an exception, but if the file cannot be created, EIO is returned, which can mean a lot of things.
Apparently for Windows we will have to do as you say, I will gladly accept this change.

@mxlgv mxlgv linked a pull request Aug 16, 2024 that will close this issue
@mxlgv mxlgv added the bug Something isn't working label Aug 16, 2024
@mxlgv mxlgv closed this as completed in #93 Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants