Bug 457269

Summary: Common prefix finder does not exclude special characters
Product: [Applications] ark Reporter: Frederick Yin <fkfd>
Component: generalAssignee: Elvis Angelaccio <elvis.angelaccio>
Status: REPORTED ---    
Severity: minor CC: aacid, fkfd, rthomsen6
Priority: NOR    
Version First Reported In: 22.04.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Frederick Yin 2022-07-29 12:48:39 UTC
SUMMARY
When creating an archive of several files, ark will try to find a common prefix of all filenames. If the prefix is at least 5 characters long, the archive will be named "<prefix>.tar.gz" or "<prefix>.zip" by default. However, if the prefix already ends with a dot, the archive will be something like "files..tar.gz" with two dots. The same goes for '_', '-', and perhaps many other special characters.

STEPS TO REPRODUCE
1. Create two files named "abcde.c" and "abcde.h" in dolphin
2. Select both, then right click
3. Hover on "Compress"

OBSERVED RESULT
context menu gives "abcde..tar.gz" and "abcde..zip" (two dots)

EXPECTED RESULT
sensible filenames like "abcde.tar.gz"

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.25.3
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5

ADDITIONAL INFORMATION
I commented this under #451203 (https://bugs.kde.org/show_bug.cgi?id=451203#c3), but felt it was off-topic so I went here to file a separate bug entry.

I am writing a patch right now.
Comment 1 Frederick Yin 2022-07-29 12:57:45 UTC
Sorry, just noticed !120 (https://invent.kde.org/utilities/ark/-/merge_requests/120) on invent that says basically the same thing.