Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix processing of archives with no parent directory #4061

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

gsnedders
Copy link
Member

The ZIP files created by GitHub Actions don't have any parent directory, and just directly contain wpt_report.json, etc.

Previously, we were searching for filenames starting with "/", which obviously doesn't match if there is no parent directory.

I believe this will fix the issue described in #4020 (comment), which will hopefully allow us to close that issue.

The ZIP files created by GitHub Actions don't have any parent
directory, and just directly contain wpt_report.json, etc.

Previously, we were searching for filenames starting with "/", which
obviously doesn't match if there is no parent directory.
self.results.append(path)
if re.match(r'^.*/wpt_screenshot.*\.txt$', f.filename):
elif fnmatch.fnmatchcase(basename, 'wpt_screenshot*.txt'):
path = z.extract(f, path=self._temp_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you move (and duplicate) the path assignment into the conditional? Do the if/elif conditions have side effects?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just avoiding decompressing things unnecessarily, try to mitigate some of the risk of any sort of decompression bomb by only decompressing the files we actually care about.

@gsnedders gsnedders merged commit 716c11b into web-platform-tests:main Oct 16, 2024
12 checks passed
@gsnedders gsnedders deleted the zip_with_no_parent branch October 16, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants