mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-24 02:10:21 +00:00
vfs-extensions: don't allow whitespaces in extension
Whitespaces in file extensions are not (commonly) used, it's more likely in cases where a whitespaces occurs after a dot, that the dot does not indicatie an extension at all. This change prevents such incorrect extension detections by checking for whitespaces, and adjusts a self-check test that tested for the previous behavior.
This commit is contained in:
parent
530fb19c2e
commit
678836bbfc
|
@ -33,8 +33,9 @@
|
||||||
|
|
||||||
#include "eel-string.h"
|
#include "eel-string.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eel_filename_get_extension_offset:
|
* eel_filename_get_extension_offset:
|
||||||
|
@ -65,6 +66,14 @@ eel_filename_get_extension_offset (const char *filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (size_t i = 1; end[i] != '\0'; i += 1)
|
||||||
|
{
|
||||||
|
if (isspace (end[i]))
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (end != start)
|
if (end != start)
|
||||||
{
|
{
|
||||||
if (strcmp (end, ".gz") == 0 ||
|
if (strcmp (end, ".gz") == 0 ||
|
||||||
|
|
|
@ -9358,7 +9358,7 @@ nautilus_self_check_file_operations (void)
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo", 1, -1, FALSE), "foo foo (copy)");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo", 1, -1, FALSE), "foo foo (copy)");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo.txt", 1, -1, FALSE), "foo (copy).txt");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo.txt", 1, -1, FALSE), "foo (copy).txt");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo.txt", 1, -1, FALSE), "foo foo (copy).txt");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo.txt", 1, -1, FALSE), "foo foo (copy).txt");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo.txt txt", 1, -1, FALSE), "foo foo (copy).txt txt");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo foo.txt txt", 1, -1, FALSE), "foo foo.txt txt (copy)");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo...txt", 1, -1, FALSE), "foo.. (copy).txt");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo...txt", 1, -1, FALSE), "foo.. (copy).txt");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo...", 1, -1, FALSE), "foo... (copy)");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo...", 1, -1, FALSE), "foo... (copy)");
|
||||||
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo. (copy)", 1, -1, FALSE), "foo. (another copy)");
|
EEL_CHECK_STRING_RESULT (get_duplicate_name ("foo. (copy)", 1, -1, FALSE), "foo. (another copy)");
|
||||||
|
|
Loading…
Reference in a new issue