diff --git a/frontend/src/Archive.tsx b/frontend/src/Archive.tsx index 5aa4bc6..9a4a4c9 100644 --- a/frontend/src/Archive.tsx +++ b/frontend/src/Archive.tsx @@ -56,9 +56,11 @@ export default function Downloaded() { .then(data => files$.next(data)) const fetcherSubfolder = (sub: string) => { - const folders = sub.split('/') + const folders = sub.startsWith('/') + ? sub.substring(1).split('/') + : sub.split('/') - let subdir = folders.length > 2 + const relpath = folders.length > 2 ? folders.slice(-(folders.length - 1)).join('/') : folders.pop() @@ -67,7 +69,7 @@ export default function Downloaded() { headers: { 'Content-Type': 'application/json', }, - body: JSON.stringify({ subdir: subdir }) + body: JSON.stringify({ subdir: relpath }) }) .then(res => res.json()) .then(data => { diff --git a/server/rest/handlers.go b/server/rest/handlers.go index cf4372f..e203117 100644 --- a/server/rest/handlers.go +++ b/server/rest/handlers.go @@ -123,8 +123,7 @@ func PlayFile(ctx *fiber.Ctx) error { root := config.Instance().GetConfig().DownloadPath - //TODO: further path / file validations - + // TODO: further path / file validations if strings.Contains(filepath.Dir(string(decoded)), root) { ctx.SendStatus(fiber.StatusPartialContent) return ctx.SendFile(string(decoded))