aboutsummaryrefslogtreecommitdiff
path: root/mediaapi
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-05-17 00:33:27 +0000
committerGitHub <noreply@github.com>2023-05-17 00:33:27 +0000
commit67d68768574a234b733eb3e4061644fc098a69f6 (patch)
tree819e9a0a150b68181d91112ffc7e0d6030412b77 /mediaapi
parent0489d16f95a3d9f1f5bc532e2060bd2482d7b156 (diff)
Move MakeJoin logic to GMSL (#3081)
Diffstat (limited to 'mediaapi')
-rw-r--r--mediaapi/routing/upload.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/mediaapi/routing/upload.go b/mediaapi/routing/upload.go
index 5061d476..5ac1d076 100644
--- a/mediaapi/routing/upload.go
+++ b/mediaapi/routing/upload.go
@@ -184,8 +184,10 @@ func (r *uploadRequest) doUpload(
if err != nil {
fileutils.RemoveDir(tmpDir, r.Logger)
r.Logger.WithError(err).Error("Error querying the database by hash.")
- resErr := spec.InternalServerError()
- return &resErr
+ return &util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
if existingMetadata != nil {
// The file already exists, delete the uploaded temporary file.
@@ -194,8 +196,10 @@ func (r *uploadRequest) doUpload(
mediaID, merr := r.generateMediaID(ctx, db)
if merr != nil {
r.Logger.WithError(merr).Error("Failed to generate media ID for existing file")
- resErr := spec.InternalServerError()
- return &resErr
+ return &util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
// Then amend the upload metadata.
@@ -217,8 +221,10 @@ func (r *uploadRequest) doUpload(
if err != nil {
fileutils.RemoveDir(tmpDir, r.Logger)
r.Logger.WithError(err).Error("Failed to generate media ID for new upload")
- resErr := spec.InternalServerError()
- return &resErr
+ return &util.JSONResponse{
+ Code: http.StatusInternalServerError,
+ JSON: spec.InternalServerError{},
+ }
}
}