Bug 417007 - Spectacle should trim whitespace in filenames
Summary: Spectacle should trim whitespace in filenames
Status: CONFIRMED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (show other bugs)
Version: 19.12.1
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Boudhayan Gupta
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-01 00:17 UTC by Doug B
Modified: 2021-12-13 21:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Doug B 2020-02-01 00:17:51 UTC
SUMMARY

If you save an image with spaces after the file extension, it will not trim off the unneeded spaces.

I save templated screenshots using specific filenames I copy and paste from a Libreoffice spreadsheet. I believe that copying from a spreadsheet cell also copys a newline character as well. That also doesn't get trimmed.

STEPS TO REPRODUCE
1. Save a screenshot as "myfile.png[space]" (replacing '[space]') with an actual space character.
2. Observe the whitespace in the filename using the 'ls' command-line tool.

OBSERVED RESULT

Whitespace in filename.

EXPECTED RESULT

Automatic trimming of whitespace after file extension.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
Operating System: Kubuntu 19.10
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.12.4
Kernel Version: 5.3.0-29-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i5-9300H CPU @ 2.40GHz
Memory: 7.6 GiB of RAM
Comment 1 David Redondo 2020-02-01 09:13:30 UTC
Makes sense. Should we also trim spaces at the beginning or are there use cases for that?
Comment 2 Doug B 2020-02-01 15:21:42 UTC
I'd say so. Don't believe there is a use-case for spaces at the beginning. Maybe someone else will chime in on that.
Comment 3 Nate Graham 2020-02-05 19:50:30 UTC
Is this something we should really handle in Spectacle, or in the save dialog itself, maybe? If there isn't a valid use case for saving a file with whitespace after the filename in Spectacle, it's likely that the same is true of every other app.
Comment 4 Christoph Feck 2020-02-05 21:51:31 UTC
It would make sense to inform the user and (optionally) correct any surrounding whitespace when he enters such a template in the Spectacle configuration dialog. It also makes sense generally in the Save dialog, so I suggest to use two separate tickets.