Add folder type checks in publicFileDownloadHandler and publicFileViewHandler
This commit is contained in:
BIN
go_cloud/bin/api
BIN
go_cloud/bin/api
Binary file not shown.
@@ -3099,6 +3099,12 @@ func publicFileDownloadHandler(w http.ResponseWriter, r *http.Request, db *datab
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if it's a folder - cannot download folders
|
||||||
|
if file.Type == "folder" {
|
||||||
|
errors.WriteError(w, errors.CodeInvalidArgument, "Cannot download folders", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Determine MIME type
|
// Determine MIME type
|
||||||
mimeType := getMimeType(file.Name)
|
mimeType := getMimeType(file.Name)
|
||||||
|
|
||||||
@@ -3211,6 +3217,12 @@ func publicFileViewHandler(w http.ResponseWriter, r *http.Request, db *database.
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if it's a folder - cannot view folders directly
|
||||||
|
if file.Type == "folder" {
|
||||||
|
errors.WriteError(w, errors.CodeInvalidArgument, "Cannot view folders", http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Determine MIME type
|
// Determine MIME type
|
||||||
mimeType := getMimeType(file.Name)
|
mimeType := getMimeType(file.Name)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user