Skip to content

fix: package animated image frames into secure zip archive#14

Open
devopenstuds wants to merge 1 commit intoswe-productivity:mainfrom
devopenstuds:fix-animated-image-download
Open

fix: package animated image frames into secure zip archive#14
devopenstuds wants to merge 1 commit intoswe-productivity:mainfrom
devopenstuds:fix-animated-image-download

Conversation

@devopenstuds
Copy link
Copy Markdown

Fixes #4

const extension = lastDotIndex > 0 ? newFileName.substring(lastDotIndex + 1) : "";

// Sanitize: strip path separators then apply sanitize-filename to prevent path traversal
const safeBaseFileName = sanitize(baseFileName.replace(/[/\\]/g, ""));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sanitize already removes / and \

);
}

const zip = new AdmZip();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you think about using tar instead like src/pages/download.tsx

Copy link
Copy Markdown
Collaborator

@C4illin C4illin left a comment

Choose a reason for hiding this comment

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

Seems to work fine! Left some comments

Instead of zipping the images, maybe it would make more sense to simulate normal files so the user doesn't have to unpack a zip or tar. Generally image data shouldn't be so compressable and they can still download a tar in the end in the download dialog.

I think this can be done by adding one entry for each file to the db.

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.

Animated image conversion - Invalid link returned

2 participants