mirror of
https://github.com/coder/code-server.git
synced 2026-05-05 12:05:18 +02:00
Handle undefined body
In the latest Express it seems the body is undefined when no data is passed (instead of being empty).
This commit is contained in:
@@ -68,8 +68,8 @@ router.get("/", async (req, res) => {
|
||||
res.send(await getRoot(req))
|
||||
})
|
||||
|
||||
router.post<{}, string, { password: string; base?: string }, { to?: string }>("/", async (req, res) => {
|
||||
const password = sanitizeString(req.body.password)
|
||||
router.post<{}, string, { password?: string; base?: string } | undefined, { to?: string }>("/", async (req, res) => {
|
||||
const password = sanitizeString(req.body?.password)
|
||||
const hashedPasswordFromArgs = req.args["hashed-password"]
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user