diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index 1254174d6..b377b4719 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -612,12 +612,21 @@ overwrite_query_dialog (file_op_context_t * ctx, enum OperationMode mode) static gboolean is_wildcarded (const char *p) { + int escaped = 0; for (; *p; p++) { - if (*p == '*') - return TRUE; - if (*p == '\\' && p[1] >= '1' && p[1] <= '9') - return TRUE; + if (*p == '\\') + { + if (p[1] >= '1' && p[1] <= '9' && !escaped) + return TRUE; + escaped = !escaped; + } + else + { + if (*p == '*' && !escaped) + return TRUE; + escaped = 0; + } } return FALSE; } diff --git a/tests/src/filemanager/filegui_is_wildcarded.c b/tests/src/filemanager/filegui_is_wildcarded.c index fd3d33a61..202695f78 100644 --- a/tests/src/filemanager/filegui_is_wildcarded.c +++ b/tests/src/filemanager/filegui_is_wildcarded.c @@ -65,48 +65,48 @@ static const struct test_is_wildcarded_ds gboolean expected_result; } test_is_wildcarded_ds[] = { - { + { /* 0 */ "blabla", FALSE }, - { + { /* 1 */ "bla?bla", FALSE }, - { + { /* 2 */ "bla*bla", TRUE }, - { + { /* 3 */ "bla\\*bla", - TRUE + FALSE }, - { + { /* 4 */ "bla\\\\*bla", TRUE }, - { + { /* 5 */ "bla\\1bla", TRUE }, - { + { /* 6 */ "bla\\\\1bla", - TRUE + FALSE }, - { + { /* 7 */ "bla\\\t\\\\1bla", - TRUE + FALSE }, - { + { /* 8 */ "bla\\\t\\\\\\1bla", TRUE }, - { + { /* 9 */ "bla\\9bla", TRUE }, - { + { /* 10 */ "blabla\\", FALSE },