api.add_vfs: refuse to add duplicate
Massimo Melina committed
Feb 10, 2022 at 19:06 UTC
23aca12bb76ace8a432b4f365e5cfa24e8a147f9
2 files changed
+4
src/api.vfs.ts
+2
@@ -61,6 +61,8 @@ const apis: ApiHandlers = {
61
if (n.isTemp || !await nodeIsDirectory(n))
62
return new ApiError(403, 'invalid under')
63
const a = n.children || (n.children = [])
64
+ if (a.find(x => x.source === source))
65
+ return new ApiError(409, 'already present')
66
a.unshift({ source, name })
67
await saveVfs()
68
return {}
todo.md
+2
@@ -1,4 +1,6 @@
1
# To do
2
+- admin: warn in case of items with same name
3
+- admin: ctrl+enter to submit form
4
- password protect admin
5
- explain fields in admin
6
- allowed referer