Allow password entry for shared directories
This commit is contained in:
@@ -32,8 +32,13 @@ func (wc *WebController) serveDirectory(w http.ResponseWriter, r *http.Request,
|
||||
td.User = json.RawMessage("null")
|
||||
}
|
||||
|
||||
// A shared link can have the password of the directory in it
|
||||
var path = strings.TrimPrefix(p.ByName("path"), "/")
|
||||
var err = pdapi.GetJSON("filesystem/"+url.PathEscape(path)+"?stat", &td.Node)
|
||||
var err = pdapi.GetJSON(
|
||||
"filesystem/"+url.PathEscape(path)+"?stat&password="+
|
||||
url.QueryEscape(r.URL.Query().Get("password")),
|
||||
&td.Node,
|
||||
)
|
||||
if apiErr, ok := errors.AsType[pixelapi.Error](err); ok {
|
||||
// Set the proper response code for the error message
|
||||
switch apiErr.StatusCode {
|
||||
|
||||
Reference in New Issue
Block a user