Bug 501014

Summary: krename inserting unwanted white character when calculating delta from end of filename
Product: [Applications] krename Reporter: crptdngl71
Component: generalAssignee: Heiko Becker <heiko.becker>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot from krename showing bug

Description crptdngl71 2025-03-03 17:44:14 UTC
Created attachment 179072 [details]
Screenshot from krename showing bug

SUMMARY
krename is inserting unwanted white space in resulting filename when extracting group of characters calculated from end of filename.

STEPS TO REPRODUCE
1. Run krename.
2. Run dolphin. Browse to a folder that contains *.jpg files to be renamed using krename.
3. Per STRG+a select all image files, drag them into krename.
4. On all image files, using enhanced mode for file rename, rename all images to include exif-time and -date, replace all ":" by "+" to have an extra character to be recognizeable to distinguish date part from time part in an extra renaming step.
6. Rename all files again by adding exif time and date part again, so resulting image file names now have both "+" and ":" separated date and time parts. Because we now have exif date and time included in file name twice it is now possible to create a customized date string by replacing "+" by "-" and also add time string keeping initial ":" as separators. Time string can be created by taking last 8 characters of current resulting file name.
7. BUG: For testing purposes and showing bug: in this step I wanted to create the final file name that was intended in the first place but I got stuck with the bug. So here is a step to replicate the bug.
Create template string "dummy[$[#length-8]-[#length]]" and watch resulting file names. This template should take the last 8 characters from end of filename, no matter how long file name is.

OBSERVED RESULT
7. Some of the resulting filenames has time string extracted of input filename, as intended. But then also a group of filenames (first half of list) has an extra white space introduced (BUG).

EXPECTED RESULT
7. The extracted time tag should look like this: 12:01:15 which contains 8 characters that can be extracted by calculating #length-8 from initial file name length and extracting 8 characters until end of file name. In all file names this time tag is located at starting 8 characters beginning before end of file name. The "dummy" word shows that the last approx. half group of filenames was created correctly without a blank space between dummy and the two digits of the hour. The approx. first half group of filenames has an extra blank space between "dummy" and the two digits of the hour. This is BUG.

SOFTWARE/OS VERSIONS
Operating System: siduction 23.1
KDE Plasma Version: 6.3.2
KDE Frameworks Version: 6.11.0
Qt Version: 6.7.2
Kernel Version: 6.13.4-1-siduction-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i5-8350U CPU @ 1.70GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Intel® UHD Graphics 620