GNOME Bugzilla – Bug 349342
escaping special characters on dnd
Last modified: 2006-07-30 21:42:48 UTC
when a user drags something into a terminal window, the URI is copied into the terminal. Local filenames are even converted from full "file://" URIs to simple path names. This is a really cool feature. However, many filenames in the wild have evil characters such as !#&*()[]{}"'`<>,; and whitespace. If, for example, you were to download a .torrent from mininova.org, and then type 'azureus ' into the terminal and try to drag and drop the filename, bash would complain about the characters in that filename. The solution is to escape those characters before inserting the filename. I had written a custom algorithm to escape everything with backslashes, but Sven Herzberg suggested the g_shell_quote() function, which appears to prefer single quotes around the entire path. While using the glib builtin is clearly more elegant, I would be interested in whether people prefer backslashes to single quotes or vice versa for their shell quoting needs. bugs- This is obviously wrong if bash is not the program recieving input. I don't know to to see if a shell is recieving input, however.
Created attachment 69923 [details] [review] applies to terminal-screen.c, created according to guidelines on developers.gnome.org This patch uses g_shell_escape().
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 85926 ***