fix: check download permission in resource handler (#5891)

This commit is contained in:
kodareef5 2026-04-04 15:58:17 -04:00 committed by GitHub
parent 8adf127c7d
commit 1e03feadb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,7 +30,7 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d
Expand: true,
ReadHeader: d.server.TypeDetectionByHeader,
Checker: d,
Content: true,
Content: d.user.Perm.Download,
})
if err != nil {
return errToStatus(err), err
@ -42,6 +42,9 @@ var resourceGetHandler = withUser(func(w http.ResponseWriter, r *http.Request, d
file.ApplySort()
return renderJSON(w, r, file)
} else if encoding == "true" {
if !d.user.Perm.Download {
return http.StatusAccepted, nil
}
if file.Type != "text" {
return renderJSON(w, r, file)
}