fix: pin the file if it exists

This commit is contained in:
Derrick Hammer 2024-01-17 17:21:15 -05:00
parent 6545faad6a
commit dfd03673c9
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 0 deletions

View File

@ -158,6 +158,14 @@ func (h *HttpHandler) SmallFileUpload(jc jape.Context) {
h.portal.Logger().Error(errUploadingFile, zap.Error(err))
return
}
err = h.portal.Accounts().PinByID(upload.ID, uint(jc.Request.Context().Value(AuthUserIDKey).(uint64)))
if err != nil {
_ = jc.Error(errUploadingFileErr, http.StatusInternalServerError)
h.portal.Logger().Error(errUploadingFile, zap.Error(err))
return
}
jc.Encode(map[string]string{"hash": cidStr})
return
}