mirror of
https://github.com/documize/community.git
synced 2025-07-23 15:19:42 +02:00
Add diagnostic output for attachment download
This commit is contained in:
parent
f4a371357e
commit
1854998c80
1 changed files with 7 additions and 1 deletions
|
@ -67,7 +67,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
|||
// Get attachment being requested.
|
||||
a, err := h.Store.Attachment.GetAttachment(ctx, ctx.OrgID, request.Param(r, "attachmentID"))
|
||||
if err == sql.ErrNoRows {
|
||||
response.WriteNotFoundError(w, method, request.Param(r, "fileID"))
|
||||
response.WriteNotFoundError(w, method, request.Param(r, "attachmentID"))
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -161,6 +161,12 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
|||
canDownload = true
|
||||
}
|
||||
|
||||
if len(secureToken) == 0 && len(authToken) == 0 {
|
||||
h.Runtime.Log.Error("get attachment received no access token", err)
|
||||
response.WriteForbiddenError(w)
|
||||
return
|
||||
}
|
||||
|
||||
// Send back error if caller unable view attachment
|
||||
if !canDownload {
|
||||
h.Runtime.Log.Error("get attachment refused", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue