Skip to content

Commit 2b5cfe4

Browse files
committed
🔊 Debug
1 parent f6567ff commit 2b5cfe4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

api/r0/upload_async.go

+6
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,29 @@ func UploadMediaAsync(r *http.Request, rctx rcontext.RequestContext, user _apime
5959
}
6060

6161
// GK-CUSTOMIZATION: Check if the file type is supported
62+
rctx.Log.Error("🔊 Attempting to read file: ", filename)
6263
buf, err := io.ReadAll(r.Body)
6364
if err != nil {
65+
rctx.Log.Error("🔊 Error reading file: ", err)
6466
return &_responses.ErrorResponse{
6567
Code: common.ErrCodeBadRequest,
6668
Message: "Error reading file.",
6769
InternalCode: common.ErrCodeBadRequest,
6870
}
6971
}
72+
rctx.Log.Error("🔊 Successfully read file: ", buf)
7073
kind, err := filetype.Match(buf)
7174
if err != nil {
75+
rctx.Log.Error("🔊 Error matching file type: ", err)
7276
return &_responses.ErrorResponse{
7377
Code: common.ErrCodeBadRequest,
7478
Message: "Error matching file type.",
7579
InternalCode: common.ErrCodeBadRequest,
7680
}
7781
}
82+
rctx.Log.Error("🔊 File type: ", kind)
7883
if !isSupportedFileType(kind.Extension) {
84+
rctx.Log.Error("🔊 unsupported file type")
7985
return &_responses.ErrorResponse{
8086
Code: common.ErrCodeBadRequest,
8187
Message: "Unsupported file type.",

api/r0/upload_sync.go

+6
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,29 @@ func UploadMediaSync(r *http.Request, rctx rcontext.RequestContext, user _apimet
3535
}
3636

3737
// GK-CUSTOMIZATION: Check if the file type is supported
38+
rctx.Log.Error("🔊 Attempting to read file: ", filename)
3839
buf, err := io.ReadAll(r.Body)
3940
if err != nil {
41+
rctx.Log.Error("🔊 Error reading file: ", err)
4042
return &_responses.ErrorResponse{
4143
Code: common.ErrCodeBadRequest,
4244
Message: "Error reading file.",
4345
InternalCode: common.ErrCodeBadRequest,
4446
}
4547
}
48+
rctx.Log.Error("🔊 Successfully read file: ", buf)
4649
kind, err := filetype.Match(buf)
4750
if err != nil {
51+
rctx.Log.Error("🔊 Error matching file type: ", err)
4852
return &_responses.ErrorResponse{
4953
Code: common.ErrCodeBadRequest,
5054
Message: "Error matching file type.",
5155
InternalCode: common.ErrCodeBadRequest,
5256
}
5357
}
58+
rctx.Log.Error("🔊 File type: ", kind)
5459
if !isSupportedFileType(kind.Extension) {
60+
rctx.Log.Error("🔊 unsupported file type")
5561
return &_responses.ErrorResponse{
5662
Code: common.ErrCodeBadRequest,
5763
Message: "Unsupported file type.",

0 commit comments

Comments
 (0)