Delta Chat treats a part of file name as an extension
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:
Search for the last dot (file name extension) from the end of the file name backwards.
Should be done in the scope of https://github.com/deltachat/deltachat-core-rust/issues/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.
ftr, for the extensions there was some discussion at https://github.com/deltachat/deltachat-core-rust/pull/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; https://github.com/deltachat/deltachat-core-rust/issues/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 (https://github.com/deltachat/deltachat-core-rust/issues/4309 here, otherwise, we should move the issue to core
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