fix: uploads where saved with names still %encoded

Massimo Melina committed Jan 18, 2023 at 21:46 UTC 9bdece6e7fb4d8ef3859c2e046f0f06ee464c8ca
1 file changed +3 -2
src/middlewares.ts
+3 -2
@@ -77,8 +77,9 @@ export const serveGuiAndSharedFiles: Koa.Middleware = async (ctx, next) => {
77 if (path.startsWith(ADMIN_URI))
78 return serveAdminPrefixed(ctx,next)
79 if (ctx.method === 'PUT') { // curl -T file url/
80 - let rest = basename(path)
81 - const folder = await urlToNode(dirname(path), ctx, vfs, v => rest = v+'/'+rest)
80 + const decPath = decodeURI(path)
81 + let rest = basename(decPath)
82 + const folder = await urlToNode(dirname(decPath), ctx, vfs, v => rest = v+'/'+rest)
83 if (!folder)
84 return ctx.status = HTTP_NOT_FOUND
85 return await receiveUpload(folder, rest, ctx.req, ctx)