summaryrefslogtreecommitdiff
path: root/libgnome-desktop
diff options
context:
space:
mode:
authorRyan Gonzalez <ryan.gonzalez@collabora.com>2022-02-01 12:13:47 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2022-02-07 18:48:21 +0000
commitfbb3e9d20b226bf894ee86b29037a9924d96a16f (patch)
tree25c71cf6eb651e4503d10e70eb5b00a8bd5a3a3f /libgnome-desktop
parenteb5d2b9b49270ccdd977b96392ade22521a8f53a (diff)
downloadgnome-desktop-fbb3e9d20b226bf894ee86b29037a9924d96a16f.tar.gz
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>
Diffstat (limited to 'libgnome-desktop')
-rw-r--r--libgnome-desktop/gnome-desktop-thumbnail-script.c14
1 files changed, 14 insertions, 0 deletions
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 != '/')