Disallow folder names ending with a space on Windows.

Closes bug #2781.
This commit is contained in:
Andrej Kacian 2016-04-22 13:31:41 +02:00
parent f324ae742a
commit 61383c66ea
2 changed files with 8 additions and 1 deletions

View file

@ -4820,6 +4820,10 @@ gboolean folder_local_name_ok(const gchar *name)
alertpanel_error(_("A folder name cannot begin or end with a dot."));
return FALSE;
}
if (name[strlen(name) - 1] == ' ') {
alertpanel_error(_("A folder name can not end with a space."));
return FALSE;
}
#endif
return TRUE;

View file

@ -129,11 +129,14 @@ gboolean rssyl_subscribe(FolderItem *parent, const gchar *url,
tmpname2 = g_strdup(tmpname);
#ifdef G_OS_WIN32
/* Windows does not allow its filenames to start or end with a dot. */
/* Windows does not allow its filenames to start or end with a dot,
* or to end with a space. */
if (tmpname2[0] == '.')
tmpname2[0] = "_";
if (tmpname2[strlen(tmpname2) - 1] == '.')
tmpname2[strlen(tmpname2) - 1] = '_';
if (tmpname2[strlen(tmpname2) - 1] == ' ')
tmpname2[strlen(tmpname2) - 1] == '_';
#endif
while (folder_find_child_item_by_name(parent, tmpname2) != 0 && i < 20) {