Conversation
| // Validates the archive dir to prevent path traversal attacks. | ||
| // Returns the resolved absolute path. | ||
| export function validateArchiveDir(archiveDir) { | ||
| let resolved = path.resolve(archiveDir); |
| fs.mkdirSync(archiveDir, { recursive: true }); | ||
|
|
||
| let filename = sanitizeFilename(snapshot.name); | ||
| let filepath = path.join(archiveDir, `${filename}.json`); |
| for (let entry of entries) { | ||
| if (!entry.endsWith('.json')) continue; | ||
|
|
||
| let filepath = path.join(resolved, entry); |
| for (let entry of entries) { | ||
| if (!entry.endsWith('.json')) continue; | ||
|
|
||
| let filepath = path.join(resolved, entry); |
Add a spec that spies on Percy.replaySnapshot to throw, exercising the error-handling branch in replay.js (lines 44-46) so coverage hits 100%.
Drive archiveSnapshot through fs.writeFileSync rather than spying on the ESM module export (which is a read-only binding under babel ESM), and silence the unused-expression lint by capturing the spread result.
Add cases for serializeSnapshot with no resources field, readArchivedSnapshots skipping non-json and directory entries, and Percy honoring an explicit skipUploads when archiveDir is configured.
rishigupta1599
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2173