escaping special characters on dnd
Submitted by Thomas Folz-Donahue
Link to original bug (#349342)
Description
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.
Version: git master
Resolution: RESOLVED DUPLICATE