Skip to content

Commit 5fe12d9

Browse files
committed
🔊 Debug
1 parent 0439e24 commit 5fe12d9

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

api/r0/upload_async.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ package r0
22

33
import (
44
"errors"
5-
"io"
65
"net/http"
76
"path/filepath"
87

98
"github.com/getsentry/sentry-go"
10-
"github.com/h2non/filetype"
119
"github.com/sirupsen/logrus"
1210
"github.com/t2bot/matrix-media-repo/api/_apimeta"
1311
"github.com/t2bot/matrix-media-repo/api/_responses"
@@ -58,16 +56,18 @@ func UploadMediaAsync(r *http.Request, rctx rcontext.RequestContext, user _apime
5856
}
5957
}
6058

61-
// GK-CUSTOMIZATION: Check if the file type is supported
62-
buf, _ := io.ReadAll(r.Body)
63-
kind, _ := filetype.Match(buf)
64-
if !isSupportedFileType(kind.Extension) {
65-
return &_responses.ErrorResponse{
66-
Code: common.ErrCodeBadRequest,
67-
Message: "Unsupported file type.",
68-
InternalCode: common.ErrCodeBadRequest,
69-
}
70-
}
59+
// // GK-CUSTOMIZATION: Check if the file type is supported
60+
// buf, _ := io.ReadAll(r.Body)
61+
// kind, _ := filetype.Match(buf)
62+
// rctx.Log.Error("🔊 File type: ", kind)
63+
// if !isSupportedFileType(kind.Extension) {
64+
// rctx.Log.Error("🔊 unsupported file type")
65+
// return &_responses.ErrorResponse{
66+
// Code: common.ErrCodeBadRequest,
67+
// Message: "Unsupported file type.",
68+
// InternalCode: common.ErrCodeBadRequest,
69+
// }
70+
// }
7171

7272
rctx = rctx.LogWithFields(logrus.Fields{
7373
"mediaId": mediaId,

api/r0/upload_sync.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ package r0
22

33
import (
44
"errors"
5-
"io"
65
"net/http"
76
"path/filepath"
87
"strconv"
98

109
"github.com/getsentry/sentry-go"
11-
"github.com/h2non/filetype"
1210
"github.com/sirupsen/logrus"
1311
"github.com/t2bot/matrix-media-repo/api/_apimeta"
1412
"github.com/t2bot/matrix-media-repo/api/_responses"
@@ -34,16 +32,18 @@ func UploadMediaSync(r *http.Request, rctx rcontext.RequestContext, user _apimet
3432
}
3533
}
3634

37-
// GK-CUSTOMIZATION: Check if the file type is supported
38-
buf, _ := io.ReadAll(r.Body)
39-
kind, _ := filetype.Match(buf)
40-
if !isSupportedFileType(kind.Extension) {
41-
return &_responses.ErrorResponse{
42-
Code: common.ErrCodeBadRequest,
43-
Message: "Unsupported file type.",
44-
InternalCode: common.ErrCodeBadRequest,
45-
}
46-
}
35+
// // GK-CUSTOMIZATION: Check if the file type is supported
36+
// buf, _ := io.ReadAll(r.Body)
37+
// kind, _ := filetype.Match(buf)
38+
// rctx.Log.Error("🔊 File type: ", kind)
39+
// if !isSupportedFileType(kind.Extension) {
40+
// rctx.Log.Error("🔊 unsupported file type")
41+
// return &_responses.ErrorResponse{
42+
// Code: common.ErrCodeBadRequest,
43+
// Message: "Unsupported file type.",
44+
// InternalCode: common.ErrCodeBadRequest,
45+
// }
46+
// }
4747

4848
rctx = rctx.LogWithFields(logrus.Fields{
4949
"filename": filename,

0 commit comments

Comments
 (0)