forked from Blaster4385/file-share
feat: improve error handling for handleGetFileInfo
This commit is contained in:
parent
725f24a239
commit
f132970121
1 changed files with 4 additions and 1 deletions
|
@ -191,7 +191,10 @@ func handleGetFileInfo(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(fileInfo)
|
||||
if err := json.NewEncoder(w).Encode(fileInfo); err != nil {
|
||||
handleError(w, fmt.Errorf("error encoding response: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func storeFileInDB(ctx context.Context, id, fileName string, encryptedData []byte) error {
|
||||
|
|
Loading…
Reference in a new issue