@@ -665,16 +665,24 @@ func tagsHandler(w http.ResponseWriter, r *http.Request) {
665
665
// should be appended to. For new databases it's not needed, but for existing databases it's required (its used to
666
666
// detect out of date / conflicting uploads)
667
667
func uploadHandler (w http.ResponseWriter , r * http.Request ) {
668
- // Set the maximum accepted database size for uploading
669
- r .Body = http .MaxBytesReader (w , r .Body , com .MaxDatabaseSize * 1024 * 1024 )
670
-
671
668
// Authenticate the request
672
669
loggedInUser , err := checkAuth (w , r )
673
670
if err != nil {
674
671
jsonErr (w , err .Error (), http .StatusUnauthorized )
675
672
return
676
673
}
677
674
675
+ // Set the maximum accepted database size for uploading
676
+ oversizeAllowed := false
677
+ for _ , user := range com .Conf .Environment .SizeOverrideUsers {
678
+ if loggedInUser == user {
679
+ oversizeAllowed = true
680
+ }
681
+ }
682
+ if ! oversizeAllowed {
683
+ r .Body = http .MaxBytesReader (w , r .Body , com .MaxDatabaseSize * 1024 * 1024 )
684
+ }
685
+
678
686
// Extract the database name and (optional) commit ID for the database from the request
679
687
_ , dbName , commitID , err := com .GetFormODC (r )
680
688
if err != nil {
@@ -691,14 +699,15 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
691
699
}
692
700
693
701
// Check whether the uploaded database is too large
694
- // TODO: Have a list of users (from the config.toml file) which don't have this check applied
695
- if r .ContentLength > (com .MaxDatabaseSize * 1024 * 1024 ) {
696
- jsonErr (w ,
697
- fmt .Sprintf ("Database is too large. Maximum database upload size is %d MB, yours is %d MB" ,
698
- com .MaxDatabaseSize , r .ContentLength / 1024 / 1024 ), http .StatusBadRequest )
699
- log .Println (fmt .Sprintf ("'%s' attempted to upload an oversized database %d MB in size. Limit is %d MB\n " ,
700
- loggedInUser , r .ContentLength / 1024 / 1024 , com .MaxDatabaseSize ))
701
- return
702
+ if ! oversizeAllowed {
703
+ if r .ContentLength > (com .MaxDatabaseSize * 1024 * 1024 ) {
704
+ jsonErr (w ,
705
+ fmt .Sprintf ("Database is too large. Maximum database upload size is %d MB, yours is %d MB" ,
706
+ com .MaxDatabaseSize , r .ContentLength / 1024 / 1024 ), http .StatusBadRequest )
707
+ log .Println (fmt .Sprintf ("'%s' attempted to upload an oversized database %d MB in size. Limit is %d MB\n " ,
708
+ loggedInUser , r .ContentLength / 1024 / 1024 , com .MaxDatabaseSize ))
709
+ return
710
+ }
702
711
}
703
712
704
713
// Process the upload
0 commit comments