Skip to content

Commit 2c0ed66

Browse files
veractormtwebster
authored andcommitted
Actions: Escape path spaces when they are unquoted
This deprecates the EscapeSpaces field. Escape spaces in paths when the Quote field is not set to either single or double. Since spaces are now escaped when required, the EscapeSpaces field is obsolete, and is hence deprecated. The field now does nothing. See #3059.
1 parent 5cea882 commit 2c0ed66

File tree

2 files changed

+12
-25
lines changed

2 files changed

+12
-25
lines changed

files/usr/share/nemo/actions/sample.nemo_action

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ Extensions=any;
9696

9797
#Conditions=desktop;
9898

99-
# Escape Spaces - set to true to escape spaces in filenames and uris ($U, $F, $P, $D)
99+
# Escape Spaces (deprecated)
100100
#
101-
# Sometimes this may be preferred to getting raw filenames that must be enclosed in
102-
# quotes.
101+
# This field is deprecated and does nothing - paths with spaces, as well as other special
102+
# shell characters, will now be passed on correctly no matter what, even when Quote is not set.
103103
#
104104
# Optional - by default this is false
105105

106-
EscapeSpaces=true
106+
#EscapeSpaces=true
107107

108108
# Run in terminal - set to true to execute the Exec line in a spawned terminal window.
109109
#

libnemo-private/nemo-action.c

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,31 +1213,23 @@ find_token_type (const gchar *str, TokenType *token_type)
12131213
static gchar *
12141214
get_path (NemoAction *action, NemoFile *file)
12151215
{
1216-
gchar *ret, *escaped, *orig;
1216+
gchar *ret, *orig;
12171217

12181218
orig = nemo_file_get_path (file);
12191219

12201220
if (action->quote_type == QUOTE_TYPE_DOUBLE) {
1221-
escaped = eel_str_escape_double_quoted_content (orig);
1221+
ret = eel_str_escape_double_quoted_content (orig);
12221222
} else if (action->quote_type == QUOTE_TYPE_SINGLE) {
12231223
// Replace literal ' with a close ', a \', and an open '
1224-
escaped = eel_str_replace_substring (orig, "'", "'\\''");
1224+
ret = eel_str_replace_substring (orig, "'", "'\\''");
12251225
} else {
12261226
escaped = eel_str_escape_non_space_special_characters (orig);
1227-
}
1228-
1229-
if (action->escape_space) {
12301227
ret = eel_str_escape_spaces (escaped);
1231-
} else {
1232-
ret = escaped;
1228+
g_free (escaped);
12331229
}
12341230

12351231
g_free (orig);
12361232

1237-
if (ret != escaped) {
1238-
g_free (escaped);
1239-
}
1240-
12411233
return ret;
12421234
}
12431235

@@ -1300,23 +1292,18 @@ get_device_path (NemoAction *action, NemoFile *file)
13001292
id = g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE);
13011293

13021294
if (action->quote_type == QUOTE_TYPE_DOUBLE) {
1303-
escaped = eel_str_escape_double_quoted_content (id);
1295+
ret = eel_str_escape_double_quoted_content (id);
13041296
} else if (action->quote_type == QUOTE_TYPE_SINGLE) {
13051297
// Replace literal ' with a close ', a \', and an open '
1306-
escaped = eel_str_replace_substring (id, "'", "'\\''");
1298+
ret = eel_str_replace_substring (id, "'", "'\\''");
13071299
} else {
13081300
escaped = eel_str_escape_non_space_special_characters (id);
1309-
}
1310-
1311-
g_free (id);
1312-
1313-
if (action->escape_space) {
13141301
ret = eel_str_escape_spaces (escaped);
13151302
g_free (escaped);
1316-
} else {
1317-
ret = escaped;
13181303
}
13191304

1305+
g_free (id);
1306+
13201307
g_object_unref (mount);
13211308
g_object_unref (volume);
13221309

0 commit comments

Comments
 (0)