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 349342 - escaping special characters on dnd
escaping special characters on dnd
Status: RESOLVED DUPLICATE of bug 85926
Product: gnome-terminal
Classification: Core
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-07-30 20:12 UTC by Thomas Folz-Donahue
Modified: 2006-07-30 21:42 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
applies to terminal-screen.c, created according to guidelines on developers.gnome.org (1.32 KB, patch)
2006-07-30 20:14 UTC, Thomas Folz-Donahue
committed Details | Review

Description Thomas Folz-Donahue 2006-07-30 20:12:10 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.
Comment 1 Thomas Folz-Donahue 2006-07-30 20:14:13 UTC
Created attachment 69923 [details] [review]
applies to terminal-screen.c, created according to guidelines on developers.gnome.org

This patch uses g_shell_escape().
Comment 2 Olav Vitters 2006-07-30 20:33:10 UTC
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 ***