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[frontend]: parsing 's' in expiration #42

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 frontend/index.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ window.addEventListener('DOMContentLoaded', () => {
let customName = '', adminUrl = '', file = null

const NAME_REGEX = /^[a-zA-Z0-9+_\-\[\]*$@,;]{3,}$/
const EXPIRE_REGEX = /^\d+\s*[mhdwM]?$/
const EXPIRE_REGEX = /^\d+\s*[smhdwM]?$/
const submitButton = $('#submit-button')
const deleteButton = $('#delete-button')
const pasteEditArea = $('#paste-textarea')
Expand Down
4 changes: 2 additions & 2 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function parsePath(pathname) {
}

export function parseExpiration(expirationStr) {
const EXPIRE_REGEX = /^[\d\.]+\s*[mhdwM]?$/
const EXPIRE_REGEX = /^[\d\.]+\s*[smhdwM]?$/
if (!EXPIRE_REGEX.test(expirationStr)) {
throw new WorkerError(400, `‘${expirationStr}’ is not a valid expiration specification`)
}
Expand Down Expand Up @@ -136,4 +136,4 @@ export function getDispFilename(fields) {

export function isLegalUrl(url) {
return URL.canParse(url)
}
}
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ async function handleNormalRequest(request, env, ctx) {
throw new WorkerError(405, "method not allowed")
}
}