GNOME Bugzilla – Bug 698892
Error when dropping text with a slash (/)
Last modified: 2013-07-29 17:47:45 UTC
Steps to reproduce: Select text containing a slash ("/"). [Such as this very sentence.] Drag the text selection and drop on a folder in nautilus. Actual result: No file is created and this dialog pops up: > . > / \ Error while creating file ").txt. > / ! \ > /_____\ There was an error creating the directory in /home/antonio. > > [-] Show more details > > Error opening file '/home/antonio/Select text containing a > slash ("/").txt': No such file or directory > > [ Cancel ] [ Skip ] Expected result: Text file is created with the dropped text. File name is created by replacing the slash with "-" or something.
Created attachment 249828 [details] [review] Replaces slashes with dashes in filenames I added a check for invalid characters in the final filename that fixes this issue.
Review of attachment 249828 [details] [review]: ::: src/nautilus-view-dnd.c @@ +385,3 @@ + /* Remove any invalid characters */ + for (i = 0; ( i < g_utf8_strlen (filename, -1) ); i++) { Two things here * coding style: remove brackets around the i< check * you're looping character by character, but accessing the offset into the string by byte. That is, filename[i] might not be the i-th character in the string if some character are larger than one byte. You should use something like g_utf8_next_char() to advance in the string and g_utf8_get_char() to get the character value
Created attachment 250088 [details] [review] New patch with proper UTF8 string-walking
Review of attachment 250088 [details] [review]: Looks good to me now, thanks!
Was this patch committed to master? I can't find it. I searched with https://git.gnome.org/browse/nautilus/log/?qt=author&q=William+Kunkel and https://git.gnome.org/browse/nautilus/log/?qt=grep&q=Bug+698892 I was not able to find anything there. Please commit the patch to master and close the bug if the patch has resolved the reported issue(s)? Thank you.
It's not committed, otherwise the patch status would have read "committed", and the bug status RESOLVED FIXED...
Sorry, I've not really done this before. Do I need to do something to move this bug forward, or is it out of my hands now?
(In reply to comment #6) Thanks, err isn't that obvious? Any particular reason that this has not been committed to master *yet*? If you want me to, I can try this patch out, test it and commit to master and of course close the bug. Please confirm if you want me to do so. Thanks.
I just haven't had the time to push the patch previously :) I now committed it to master, so this bug can be closed accordingly.