mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
zip: Ignore symlinks when recursively zipping files
This prevents infinite loops when symlinks point to a parent directory.
This commit is contained in:
parent
fcdd56633b
commit
fa7ae7288b
1 changed files with 4 additions and 3 deletions
|
@ -101,11 +101,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
|
Core::DirIterator it(path, Core::DirIterator::Flags::SkipParentAndBaseDir);
|
||||||
while (it.has_next()) {
|
while (it.has_next()) {
|
||||||
auto child_path = it.next_full_path();
|
auto child_path = it.next_full_path();
|
||||||
if (!Core::File::is_directory(child_path)) {
|
if (Core::File::is_link(child_path))
|
||||||
|
return;
|
||||||
|
if (!Core::File::is_directory(child_path))
|
||||||
add_file(child_path);
|
add_file(child_path);
|
||||||
} else {
|
else
|
||||||
handle_directory(child_path, handle_directory);
|
handle_directory(child_path, handle_directory);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue