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

Delta Chat treats a part of file name as an extension #5338

Open
dev24126 opened this issue Jan 31, 2024 · 4 comments · May be fixed by #4583
Open

Delta Chat treats a part of file name as an extension #5338

dev24126 opened this issue Jan 31, 2024 · 4 comments · May be fixed by #4583
Assignees
Labels
bug Something is not working

Comments

@dev24126
Copy link

dev24126 commented Jan 31, 2024

On Desktop I attached a file to the message. Filename: "Chor St. Otto Bismarck - Mitglieder.html".
But the attached file was renamed to "Chor St.otto bismarck mitglieder.html".

Seems that changes happens after the first dot instead of the last one. Problem happens when more than one dot is in the file name.
Solution could be to find the last dot by searching the dot from the end of the file name.

  • Operating System (Linux/Mac/Windows/iOS/Android): Windows
  • Delta Chat Version: 1.42.2
  • Expected behavior: Keep the filename as it is. Do not change it.
  • Actual behavior: Changes the filename.
  • Steps to reproduce the problem:
  • Screenshots:
  • Logs:
@dev24126
Copy link
Author

dev24126 commented Mar 9, 2024

Search for the last dot (file name extension) from the end of the file name backwards.

@iequidoo
Copy link
Collaborator

Should be done in the scope of #4309. We will save the original file name which is passed in the message, so both sides will see it. Looks like the source of the problem is using the sanitize_filename crate, but it won't be needed anymore.

@r10s
Copy link
Member

r10s commented Mar 11, 2024

ftr, for the extensions there was some discussion at #3227 - which is probably also the reason for the lowercasing in this issue as all of . Otto Bismarck - Mitglieder.html is regarded as the extension.

indeed, it is better to preserve the name completely, and do all comparisons case-insensitive; #4309 may indeed help on that. however, that needs to be done carefully, with tests and all, to not open larger issues

in any case, it seems there is not much desktop can do about this issue, so we can close it if it is included in (#4309 here, otherwise, we should move the issue to core

@iequidoo iequidoo changed the title Delta Chat changes file name of the attachment Delta Chat treats a part of file name as an extension Mar 11, 2024
@iequidoo iequidoo transferred this issue from deltachat/deltachat-desktop Mar 11, 2024
@iequidoo iequidoo self-assigned this Mar 11, 2024
@iequidoo
Copy link
Collaborator

iequidoo commented Mar 11, 2024

Checked the code, the reason is in blob::BlobObject::sanitise_name() so this is out of the action list for #4309. Should be fixed separately on top of #4309

@iequidoo iequidoo added the bug Something is not working label Mar 11, 2024
iequidoo added a commit that referenced this issue Mar 12, 2024
…pace (#5338)

Before file extensions were also limited to 32 chars, but extra chars in the beginning were just cut off, e.g. "file.with_lots_of_characters_behind_point_and_double_ending.tar.gz" was considered to have an extension "d_point_and_double_ending.tar.gz". Better to take only "tar.gz" then.

Also don't include whitespace-containing parts in extensions. File extensions generally don't
contain whitespaces.
@iequidoo iequidoo linked a pull request Mar 13, 2024 that will close this issue
iequidoo added a commit that referenced this issue Mar 18, 2024
…pace (#5338)

Before file extensions were also limited to 32 chars, but extra chars in the beginning were just cut
off, e.g. "file.with_lots_of_characters_behind_point_and_double_ending.tar.gz" was considered to
have an extension "d_point_and_double_ending.tar.gz". Better to take only "tar.gz" then.

Also don't include whitespace-containing parts in extensions. File extensions generally don't
contain whitespaces.
iequidoo added a commit that referenced this issue Apr 24, 2024
…pace (#5338)

Before file extensions were also limited to 32 chars, but extra chars in the beginning were just cut
off, e.g. "file.with_lots_of_characters_behind_point_and_double_ending.tar.gz" was considered to
have an extension "d_point_and_double_ending.tar.gz". Better to take only "tar.gz" then.

Also don't include whitespace-containing parts in extensions. File extensions generally don't
contain whitespaces.
iequidoo added a commit that referenced this issue Apr 25, 2024
…pace (#5338)

Before file extensions were also limited to 32 chars, but extra chars in the beginning were just cut
off, e.g. "file.with_lots_of_characters_behind_point_and_double_ending.tar.gz" was considered to
have an extension "d_point_and_double_ending.tar.gz". Better to take only "tar.gz" then.

Also don't include whitespace-containing parts in extensions. File extensions generally don't
contain whitespaces.
iequidoo added a commit that referenced this issue Apr 27, 2024
…pace (#5338)

Before file extensions were also limited to 32 chars, but extra chars in the beginning were just cut
off, e.g. "file.with_lots_of_characters_behind_point_and_double_ending.tar.gz" was considered to
have an extension "d_point_and_double_ending.tar.gz". Better to take only "tar.gz" then.

Also don't include whitespace-containing parts in extensions. File extensions generally don't
contain whitespaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants