bugfix
This commit is contained in:
@@ -56,9 +56,11 @@ export default function Downloaded() {
|
|||||||
.then(data => files$.next(data))
|
.then(data => files$.next(data))
|
||||||
|
|
||||||
const fetcherSubfolder = (sub: string) => {
|
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.slice(-(folders.length - 1)).join('/')
|
||||||
: folders.pop()
|
: folders.pop()
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ export default function Downloaded() {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ subdir: subdir })
|
body: JSON.stringify({ subdir: relpath })
|
||||||
})
|
})
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|||||||
@@ -123,8 +123,7 @@ func PlayFile(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
root := config.Instance().GetConfig().DownloadPath
|
root := config.Instance().GetConfig().DownloadPath
|
||||||
|
|
||||||
//TODO: further path / file validations
|
// TODO: further path / file validations
|
||||||
|
|
||||||
if strings.Contains(filepath.Dir(string(decoded)), root) {
|
if strings.Contains(filepath.Dir(string(decoded)), root) {
|
||||||
ctx.SendStatus(fiber.StatusPartialContent)
|
ctx.SendStatus(fiber.StatusPartialContent)
|
||||||
return ctx.SendFile(string(decoded))
|
return ctx.SendFile(string(decoded))
|
||||||
|
|||||||
Reference in New Issue
Block a user