diff --git a/web/src/utils/file/index.ts b/web/src/utils/file/index.ts index 057b5933..03521d48 100644 --- a/web/src/utils/file/index.ts +++ b/web/src/utils/file/index.ts @@ -280,7 +280,7 @@ const checkName = (name: string) => { } const checkPath = (path: string) => { - return /^(?!\/)(?!.*\/$)(?!.*\/\/)(?!.*\s).*$/.test(path) + return /^(?!\/)(?!.*\/$)(?!.*\/\/).*$/.test(path) } const getFilename = (path: string) => { diff --git a/web/src/views/file/PathInput.vue b/web/src/views/file/PathInput.vue index a072e87c..2942c608 100644 --- a/web/src/views/file/PathInput.vue +++ b/web/src/views/file/PathInput.vue @@ -27,6 +27,7 @@ const handleInput = () => { } const handleBlur = () => { + input.value = input.value.replace(/(^\/)|(\/$)/g, '') if (!checkPath(input.value)) { window.$message.error('路径不合法') return