summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Berla <corey@berla.me>2023-01-09 10:02:43 -0800
committerAntónio Fernandes <antoniof@gnome.org>2023-01-10 03:22:02 +0000
commitd22207b4dd2adbc099f37c407189f5566e9b9b38 (patch)
treee9a6a765e85bb70f734e09ae84569d2af363f83b
parentcfded2c02ecff529bbf98a1e4c0277d9348588b8 (diff)
downloadnautilus-d22207b4dd2adbc099f37c407189f5566e9b9b38.tar.gz
gtkbookmarkmanager: Don't allow newlines in the bookmark label
The gtk bookmark file stores bookmarks as follows: <encoded file 1 uri> <file 1 label (optional)> <encoded file 2 uri> <file 2 label (optional)> ... File names (uri's) with newlines actually function "correctly" because the newlines get encoded as %0A. The label however is not encoded and it would be problematic to start encoding it at this point. Since the sidebar entries should be 1 line anyways, let's just use our existing eel_str_replace_substring() to change the newline to a space. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/1502
-rw-r--r--src/gtk/nautilusgtkbookmarksmanager.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gtk/nautilusgtkbookmarksmanager.c b/src/gtk/nautilusgtkbookmarksmanager.c
index 86f3bb4d9..125bb4d13 100644
--- a/src/gtk/nautilusgtkbookmarksmanager.c
+++ b/src/gtk/nautilusgtkbookmarksmanager.c
@@ -22,6 +22,7 @@
*/
#include "config.h"
+#include <eel/eel-string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "nautilus-enum-types.h"
@@ -564,7 +565,7 @@ _nautilus_gtk_bookmarks_manager_set_bookmark_label (NautilusGtkBookmarksManager
GtkBookmark *bookmark = link->data;
g_free (bookmark->label);
- bookmark->label = g_strdup (label);
+ bookmark->label = eel_str_replace_substring (label, "\n", " ");
}
else
{