GNOME Bugzilla – Bug 327068
"Copy Photo Location" should put quotes around space-containing filenames
Last modified: 2018-07-12 00:03:05 UTC
I have photos in several folders, including one called "f-spot import test". This makes life interesting when I try to do anything on the bash prompt with them. For example, here's what happens when I select four photos from two different locations, use "Copy Photo Location" to get their filenames, and then try to paste the result into a bash prompt command: rmunn@localhost:~$ ls /home/rmunn/Photos/2006/1/14/DSCN4164.jpg /home/rmunn/Photos/2006/1/14/DSCN4163.jpg /home/rmunn/f-spot import test/foo/img_3476.jpg /home/rmunn/f-spot import test/foo/img_3475.jpg ls: /home/rmunn/f-spot: No such file or directory ls: import: No such file or directory ls: test/foo/img_3476.jpg: No such file or directory ls: /home/rmunn/f-spot: No such file or directory ls: import: No such file or directory ls: test/foo/img_3475.jpg: No such file or directory /home/rmunn/Photos/2006/1/14/DSCN4163.jpg /home/rmunn/Photos/2006/1/14/DSCN4164.jpg If the list of filenames is to be useable, it should probably have quotes around any filenames that contain spaces or other special characters. In the above example, it would have been easy enough to add the quotes myself, but doing so for 200+ photos at a time would quickly get tedious. Thanks!
I have a simple patch that escapes any special characters, and produces this for a photo in folder "test ing this": /home/gabe/Desktop/Photos/test%20ing%20this/pict0027.jpg The one-liner is this: Gnome.Vfs.Escape.PathString (System.IO.Path.GetFullPath (p.DefaultVersionPath)) Is this going to cause any problems with anything? Is there some spec we are following when we put the URIs in the clipboard?
http://www.rfc-archive.org/getrfc.php?rfc=2483 section 5 is about as close as you get I think. The main thing is, does this actually fix the problem if the uri is pasted to say a gnome-terminal? It does its own unescaping
When I do 'Copy Photo Location' and paste it into gnome-terminal, it does not escape it for me (eg the spaces in the path still show up). Would quotation marks be the way to go here? It doesn't seem so to me. From reading the RFC's, it sounds like if we're calling the paths URIs, then we should escape them.
Also very related to bug #443862
This trivial patch adds quoting, which has fixed the problems with using f-spot in conjunction with a terminal for me. diff --git a/src/MainWindow.cs b/src/MainWindow.cs index 69cbfae..cc14c73 100644 --- a/src/MainWindow.cs +++ b/src/MainWindow.cs @@ -2418,3 +2418,3 @@ namespace FSpot foreach (Photo p in SelectedPhotos ()) { - pt.Add (System.IO.Path.GetFullPath (p.DefaultVersionUri.LocalPath)); + pt.Add ("\"" + System.IO.Path.GetFullPath (p.DefaultVersionUri.LocalPath) + "\""); }
*** Bug 620749 has been marked as a duplicate of this bug. ***
F-Spot has moved to https://github.com/f-spot/f-spot/issues If this Bugzilla ticket is still valid in a recent version of F-Spot, please feel free to post this topic as a ticket in the F-Spot project on GitHub. Closing this report as WONTFIX as part of Bugzilla Housekeeping as we are planning to shut down GNOME Bugzilla in favor of GNOME Gitlab.