[gnome-desktop] thumbnail: Resolve symlinks before exporting them with Flatpak
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] thumbnail: Resolve symlinks before exporting them with Flatpak
- Date: Mon, 7 Feb 2022 19:25:16 +0000 (UTC)
commit fbb3e9d20b226bf894ee86b29037a9924d96a16f
Author: Ryan Gonzalez <ryan gonzalez collabora com>
Date: Tue Feb 1 12:13:47 2022 -0600
thumbnail: Resolve symlinks before exporting them with Flatpak
Otherwise, only the symlink target is sent into the sandbox, so the symlink
itself is not found, and thumbnailing fails.
Signed-off-by: Ryan Gonzalez <ryan gonzalez collabora com>
libgnome-desktop/gnome-desktop-thumbnail-script.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail-script.c
b/libgnome-desktop/gnome-desktop-thumbnail-script.c
index 841ca17d..b6c31e93 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail-script.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail-script.c
@@ -984,6 +984,20 @@ script_exec_new (const char *uri,
{
char *tmpl;
const char *sandbox_dir;
+ g_autofree char *resolved_infile = NULL;
+
+ /* Make sure any symlinks in the path are resolved, because the resolved
+ * path is what's exposed by Flatpak into the sandbox */
+ resolved_infile = realpath (exec->infile, NULL);
+ if (!resolved_infile)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),
+ "Failed to resolve '%s': '%s'", exec->infile, g_strerror (errno));
+ goto bail;
+ }
+
+ g_free (exec->infile);
+ exec->infile = g_steal_pointer (&resolved_infile);
sandbox_dir = g_getenv ("FLATPAK_SANDBOX_DIR");
if (!sandbox_dir || *sandbox_dir != '/')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]