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

Add support for extensions with numbers (eg mp3, woff2) #6714

Merged
merged 4 commits into from
Nov 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/keystone/src/lib/context/createFilesContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const generateSafeFilename = (
// This regex lazily matches for any characters that aren't a new line
// it then optionally matches the last instance of a "." symbol
// followed by any alphabetical character before the end of the string
dcousens marked this conversation as resolved.
Show resolved Hide resolved
const [, name, ext] = filename.match(/^([^:\n].*?)(\.[A-Za-z]+)?$/) as RegExpMatchArray;
const [, name, ext] = filename.match(/^([^:\n].*?)(\.[A-Za-z0-9]+)?$/) as RegExpMatchArray;

const id = crypto
.randomBytes(24)
Expand Down