After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593372 - save dialog treats trailing spaces literally
save dialog treats trailing spaces literally
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other All
: Normal minor
: Small feature
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2009-08-28 10:59 UTC by fpuga
Modified: 2015-07-04 23:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Strip leading and trailing whitespace from filechooser save filenames (1.86 KB, patch)
2015-07-01 23:27 UTC, Arc Riley
committed Details | Review

Description fpuga 2009-08-28 10:59:48 UTC
Gnome allow adds trailing whitespaces after the filename (and the extension). For example you can rename the file 'name.ext' to be 'name.ext '

This happens when you save a file in any program too. Example:

1.- gedit foo.txt
2.- Edit the file and save
3.- Edit the file, and save as 'foo.txt ', now we have two files.

Programs that expects a concrete filename will fail trying to open it. For example uncompress a rar archive with file-roller splitted in various parts.

I'm not sure if this is bug or a feature, but anyway i think it isn't the behaviour that expects normal users. I know that it isn't a normal situation but can happen in a mistake.

I find a bug a bit old that can be related to this http://bugzilla.gnome.org/show_bug.cgi?id=133806
Comment 1 Allison Karlitskaya (desrt) 2009-11-21 00:27:24 UTC
This is not for GIO to deal with.

Punting to GTK -- maybe the file save dialog should have code to say "are you sure you want to have a space at the end of the filename?" or maybe it should just silently drop it.
Comment 2 Allison Karlitskaya (desrt) 2009-11-24 21:23:10 UTC
Federico: if you're adding 'gnome-love' keyword, do you have suggestions about what the correct behaviour should be?
Comment 3 Federico Mena Quintero 2009-11-24 23:04:27 UTC
We should extract the basename of the file (i.e. without directories) and ask the user if he has leading or trailing spaces.  Dropping spaces silently is a no-no.

This should only be done for the SAVE and CREATE_FOLDER modes, of course.
Comment 4 Matthias Clasen 2009-11-24 23:59:49 UTC
Might also want to ask about other 'bad' filename patterns, like names starting with one or more dots.
Comment 5 Stephen Albert 2010-07-16 20:51:04 UTC
What about bash globbing characters (e.g. '[' ']' '*' '?' '^' ) or '!'? The user can, of course, put the filename in quotes to handle it in the shell, but to an ignorant user these rules can be frustrating.
Comment 6 Arc Riley 2015-07-01 22:23:14 UTC
I split the folder creation part of this to https://bugzilla.gnome.org/show_bug.cgi?id=751800 which has a patch pending.
Comment 7 Arc Riley 2015-07-01 23:27:12 UTC
Created attachment 306568 [details] [review]
Strip leading and trailing whitespace from filechooser save filenames
Comment 8 Matthias Clasen 2015-07-04 23:22:14 UTC
Review of attachment 306568 [details] [review]:

Looks ok. I've pushed it with a few cosmetic fixups.
Comment 9 Matthias Clasen 2015-07-04 23:22:28 UTC
Attachment 306568 [details] pushed as 94bcdd3 - Strip leading and trailing whitespace from filechooser save filenames