fix (share): broken share feature

This commit is contained in:
Mickael KERJEAN
2018-11-26 23:00:22 +11:00
parent c71214455a
commit 377048fd35
3 changed files with 9 additions and 7 deletions
+1 -2
View File
@@ -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)
}
+4 -1
View File
@@ -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"`
+4 -4
View File
@@ -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)
}