fixed some path issues

This commit is contained in:
ston1th 2019-05-02 14:50:28 +02:00
commit 38c2a72fe0
5 changed files with 22 additions and 28 deletions

View file

@ -161,9 +161,10 @@ func registerHandler(ctx *Context) {
}
}
func fileHandler(ctx *Context) {
func rawHandler(ctx *Context) {
defer ctx.Log()
f, fi, err := ctx.Srv.FS.GetFile(ctx.Path())
path := strings.TrimPrefix(ctx.Path(), core.RawPrefix)
f, fi, err := ctx.Srv.FS.GetFile(path)
if err != nil {
ctx.Status(http.StatusNotFound)
err = ctx.Write([]byte(noSuchFile))
@ -356,6 +357,7 @@ func deleteHandler(ctx *Context) {
if err != nil {
log.Printf("db: delete: %s %s", f, err)
}
log.Debugf("delete %s id: %s from index", f, id)
if id == "" {
continue
}

View file

@ -40,7 +40,7 @@ var prefixRoutes = []route{
core.RawPrefix,
jwtHandler(
authHandler(
fileHandler)),
rawHandler)),
[]string{"GET"},
},
{