fileUtils: Do not follow symlinks

Extensions should not include symlinks, in particular ones that
point outside the extension directory. However if they do, then
we should only move/remove the link rather than the files it
points to.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6182

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2571>
This commit is contained in:
Florian Müllner 2022-12-05 13:56:57 +01:00 committed by Marge Bot
parent 69600f3bfd
commit 1a9e072ca0

View File

@ -45,7 +45,7 @@ function* collectFromDatadirs(subdir, includeUserDir) {
function recursivelyDeleteDir(dir, deleteParent) {
let children = dir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
let info;
while ((info = children.next_file(null)) != null) {
@ -63,7 +63,7 @@ function recursivelyDeleteDir(dir, deleteParent) {
function recursivelyMoveDir(srcDir, destDir) {
let children = srcDir.enumerate_children('standard::name,standard::type',
Gio.FileQueryInfoFlags.NONE, null);
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null);
if (!destDir.query_exists(null))
destDir.make_directory_with_parents(null);