Skip to content

Add archive snapshots option and separate replay command#2216

Open
prklm10 wants to merge 9 commits intomasterfrom
pr-2173
Open

Add archive snapshots option and separate replay command#2216
prklm10 wants to merge 9 commits intomasterfrom
pr-2173

Conversation

@prklm10
Copy link
Copy Markdown
Contributor

@prklm10 prklm10 commented May 7, 2026

@prklm10 prklm10 requested a review from a team as a code owner May 7, 2026 05:56
// 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);
prklm10 added 4 commits May 7, 2026 12:50
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.
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.

4 participants