GNOME Bugzilla – Bug 770870
Batch renaming: Can't search and replace with "." or ".."
Last modified: 2016-09-06 09:32:36 UTC
When using batch renaming with the search and replace feature, it is not possible to replace a string with "." or ".." as nautilus claims those are invalid file names. While it is true that these by themselves would be invalid file names, the file names resulting from the replacement are still valid in most cases. It seems like the check for valid file names is run on the replacement string rather than on the resulting file names.
Created attachment 334776 [details] [review] batch-rename-dialog: fix search & replace for . and .. In the replace mode, when "." or ".." were typed in the replace entry, there would always pop up an error, saying that a file would have an invalid name. In this case, instead of checking the entry, the check must actually be done to all the new names to see if any of those are equal to "." or "..". Since the new names are now used in this function, these have to be obtained before.
Review of attachment 334776 [details] [review]: Hey, thanks for the patch! Some nitpicks ::: src/nautilus-batch-rename-dialog.c @@ +1995,3 @@ + if (g_strcmp0 (new_name->str, ".") == 0) + { + have_unallowed_character_dot = TRUE; you can break; here @@ +2012,3 @@ + if (g_strcmp0 (new_name->str, "..") == 0) + { + { you can break; here
Created attachment 334845 [details] [review] batch-rename-dialog: fix search & replace for . and .. In the replace mode, when "." or ".." were typed in the replace entry, there would always pop up an error, saying that a file would have an invalid name. In this case, instead of checking the entry, the check must actually be done to all the new names to see if any of those are equal to "." or "..". Since the new names are now used in this function, these have to be obtained before.
Review of attachment 334845 [details] [review]: LGTM thanks!!
Attachment 334845 [details] pushed as c7fb994 - batch-rename-dialog: fix search & replace for . and ..