mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 13:36:25 -08:00
fix route name & owned files, add more s. chars
This commit is contained in:
parent
95597fd1e0
commit
4c47d641e5
|
@ -6,7 +6,7 @@ import { files } from "./accounts";
|
|||
|
||||
import * as Accounts from "./accounts";
|
||||
|
||||
export let id_check_regex = /[A-Za-z0-9_\-\.\!]+/
|
||||
export let id_check_regex = /[A-Za-z0-9_\-\.\!\=\:]+/
|
||||
export let alphanum = Array.from("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
|
||||
|
||||
// bad solution but whatever
|
||||
|
|
|
@ -190,7 +190,7 @@ adminRoutes.post("/transfer", parser, (req,res) => {
|
|||
|
||||
})
|
||||
|
||||
adminRoutes.post("/transfer", parser, (req,res) => {
|
||||
adminRoutes.post("/idchange", parser, (req,res) => {
|
||||
|
||||
if (typeof req.body.target !== "string" || typeof req.body.new !== "string") {
|
||||
res.status(404)
|
||||
|
@ -211,12 +211,22 @@ adminRoutes.post("/transfer", parser, (req,res) => {
|
|||
return
|
||||
}
|
||||
|
||||
if (targetFile.owner) {
|
||||
Accounts.files.deindex(targetFile.owner, req.body.target)
|
||||
Accounts.files.index(targetFile.owner, req.body.new)
|
||||
}
|
||||
delete files.files[req.body.target]
|
||||
|
||||
files.writeFile(req.body.new, targetFile).then(() => {
|
||||
res.send()
|
||||
}).catch(() => {
|
||||
files.files[req.body.target] = req.body.new
|
||||
|
||||
if (targetFile.owner) {
|
||||
Accounts.files.deindex(targetFile.owner, req.body.new)
|
||||
Accounts.files.index(targetFile.owner, req.body.target)
|
||||
}
|
||||
|
||||
res.status(500)
|
||||
res.send()
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue