mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
fix (share): broken share feature
This commit is contained in:
@@ -27,7 +27,6 @@ func FileLs(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
SendSuccessResults(res, files)
|
||||
return
|
||||
}
|
||||
|
||||
path, err := pathBuilder(ctx, req.URL.Query().Get("path"))
|
||||
if err != nil {
|
||||
SendErrorResult(res, err)
|
||||
@@ -57,7 +56,7 @@ func FileLs(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
files = append(files, f)
|
||||
}
|
||||
|
||||
var perms Metadata = Metadata{}
|
||||
var perms Metadata = Metadata{}
|
||||
if obj, ok := ctx.Backend.(interface{ Meta(path string) Metadata }); ok {
|
||||
perms = obj.Meta(path)
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ func ShareUpsert(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
backend_id = ctx.Share.Backend
|
||||
|
||||
auth_cookie = ctx.Share.Auth
|
||||
path_from = ctx.Share.Path
|
||||
} else {
|
||||
@@ -63,6 +64,9 @@ func ShareUpsert(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
return a.Value
|
||||
}()
|
||||
if ctx.Session["path"] != "" {
|
||||
path_from = ctx.Session["path"]
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Share.Id != "" {
|
||||
@@ -201,7 +205,6 @@ func ShareVerifyProof(ctx App, res http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
Log.Info("SHAREGET('%+v')", s)
|
||||
SendSuccessResult(res, struct {
|
||||
Id string `json:"id"`
|
||||
Path string `json:"path"`
|
||||
|
||||
@@ -23,15 +23,15 @@ func APIHandler(fn func(App, http.ResponseWriter, *http.Request), ctx App) http.
|
||||
}
|
||||
share_id := req.URL.Query().Get("share");
|
||||
if ctx.Share, err = ExtractShare(req, &ctx, share_id); err != nil {
|
||||
SendErrorResult(res, ErrNotValid)
|
||||
SendErrorResult(res, err)
|
||||
return
|
||||
}
|
||||
if ctx.Session, err = ExtractSession(req, &ctx); err != nil {
|
||||
SendErrorResult(res, ErrNotValid)
|
||||
SendErrorResult(res, err)
|
||||
return
|
||||
}
|
||||
if ctx.Backend, err = ExtractBackend(req, &ctx); err != nil {
|
||||
SendErrorResult(res, ErrNotValid)
|
||||
SendErrorResult(res, err)
|
||||
return
|
||||
}
|
||||
resw := ResponseWriter{ResponseWriter: res}
|
||||
@@ -90,7 +90,7 @@ func ExtractShare(req *http.Request, ctx *App, share_id string) (Share, error) {
|
||||
return Share{}, nil
|
||||
}
|
||||
|
||||
if ctx.Config.Get("share.enable").Bool() == false {
|
||||
if ctx.Config.Get("features.share.enable").Bool() == false {
|
||||
return Share{}, NewError("Feature isn't enable, contact your administrator", 405)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user