@@ -28,7 +28,7 @@ const (
28
28
tarMimeType = "application/x-tar"
29
29
zipMimeType = "application/zip"
30
30
31
- httpFileMaxBytes = 10 * (10 << 20 )
31
+ HTTPFileMaxBytes = 10 * (10 << 20 )
32
32
)
33
33
34
34
// @Summary Upload file
@@ -56,7 +56,7 @@ func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
56
56
return
57
57
}
58
58
59
- r .Body = http .MaxBytesReader (rw , r .Body , httpFileMaxBytes )
59
+ r .Body = http .MaxBytesReader (rw , r .Body , HTTPFileMaxBytes )
60
60
data , err := io .ReadAll (r .Body )
61
61
if err != nil {
62
62
httpapi .Write (ctx , rw , http .StatusBadRequest , codersdk.Response {
@@ -76,7 +76,7 @@ func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
76
76
return
77
77
}
78
78
79
- data , err = archive .CreateTarFromZip (zipReader , httpFileMaxBytes )
79
+ data , err = archive .CreateTarFromZip (zipReader , HTTPFileMaxBytes )
80
80
if err != nil {
81
81
httpapi .Write (ctx , rw , http .StatusInternalServerError , codersdk.Response {
82
82
Message : "Internal error processing .zip archive." ,
@@ -182,7 +182,7 @@ func (api *API) fileByID(rw http.ResponseWriter, r *http.Request) {
182
182
183
183
rw .Header ().Set ("Content-Type" , codersdk .ContentTypeZip )
184
184
rw .WriteHeader (http .StatusOK )
185
- err = archive .WriteZip (rw , tar .NewReader (bytes .NewReader (file .Data )), httpFileMaxBytes )
185
+ err = archive .WriteZip (rw , tar .NewReader (bytes .NewReader (file .Data )), HTTPFileMaxBytes )
186
186
if err != nil {
187
187
api .Logger .Error (ctx , "invalid .zip archive" , slog .F ("file_id" , fileID ), slog .F ("mimetype" , file .Mimetype ), slog .Error (err ))
188
188
}
0 commit comments