forked from defunkt/toes
Allow dots in app and repo names
This commit is contained in:
parent
c2264c42fc
commit
e7dd220106
|
|
@ -13,7 +13,7 @@ const DATA_ROOT = process.env.DATA_ROOT!
|
|||
const TOES_URL = process.env.TOES_URL!
|
||||
|
||||
const REPOS_DIR = resolve(DATA_ROOT, 'repos')
|
||||
const VALID_NAME = /^[a-zA-Z0-9_-]+$/
|
||||
const VALID_NAME = /^[a-zA-Z0-9._-]+$/
|
||||
const VISIBILITY_PATH = join(DATA_DIR, 'visibility.json')
|
||||
|
||||
const TOGGLE_SCRIPT = `
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ async function createNewApp() {
|
|||
return
|
||||
}
|
||||
|
||||
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
||||
newAppError = 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens'
|
||||
if (!/^[a-z][a-z0-9.-]*$/.test(name)) {
|
||||
newAppError = 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens'
|
||||
renderModal()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ async function doRenameApp(input: HTMLInputElement) {
|
|||
return
|
||||
}
|
||||
|
||||
if (!/^[a-z][a-z0-9-]*$/.test(newName)) {
|
||||
renameAppError = 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens'
|
||||
if (!/^[a-z][a-z0-9.-]*$/.test(newName)) {
|
||||
renameAppError = 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens'
|
||||
renderModal()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ router.post('/', async c => {
|
|||
const name = body.name?.trim().toLowerCase().replace(/\s+/g, '-')
|
||||
if (!name) return c.json({ ok: false, error: 'App name is required' }, 400)
|
||||
|
||||
if (!/^[a-z][a-z0-9-]*$/.test(name)) {
|
||||
return c.json({ ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' }, 400)
|
||||
if (!/^[a-z][a-z0-9.-]*$/.test(name)) {
|
||||
return c.json({ ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' }, 400)
|
||||
}
|
||||
|
||||
const appPath = join(APPS_DIR, name)
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ export async function renameApp(oldName: string, newName: string): Promise<{ ok:
|
|||
|
||||
if (_apps.has(newName)) return { ok: false, error: 'An app with that name already exists' }
|
||||
|
||||
if (!/^[a-z][a-z0-9-]*$/.test(newName)) {
|
||||
return { ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, and hyphens' }
|
||||
if (!/^[a-z][a-z0-9.-]*$/.test(newName)) {
|
||||
return { ok: false, error: 'Name must start with a letter and contain only lowercase letters, numbers, dots, and hyphens' }
|
||||
}
|
||||
|
||||
const oldPath = join(APPS_DIR, oldName)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user