From 61383c66ea45ad4e17efce4c59441b35bae5ff25 Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Fri, 22 Apr 2016 13:31:41 +0200 Subject: [PATCH] Disallow folder names ending with a space on Windows. Closes bug #2781. --- src/folder.c | 4 ++++ src/plugins/rssyl/rssyl_subscribe.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/folder.c b/src/folder.c index bf286b320..2b4dbe0d1 100644 --- a/src/folder.c +++ b/src/folder.c @@ -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; diff --git a/src/plugins/rssyl/rssyl_subscribe.c b/src/plugins/rssyl/rssyl_subscribe.c index f80ec8262..d68f4ce60 100644 --- a/src/plugins/rssyl/rssyl_subscribe.c +++ b/src/plugins/rssyl/rssyl_subscribe.c @@ -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) {