@@ -390,7 +390,14 @@ func branchNamesHandler(w http.ResponseWriter, r *http.Request) {
390
390
w .WriteHeader (http .StatusBadRequest )
391
391
return
392
392
}
393
- dbOwner := strings .ToLower (usr )
393
+
394
+ // Use the established capitalisation of the username
395
+ z , err := database .User (usr )
396
+ if err != nil {
397
+ w .WriteHeader (http .StatusInternalServerError )
398
+ return
399
+ }
400
+ dbOwner := z .Username
394
401
395
402
// If any of the required values were empty, indicate failure
396
403
if dbOwner == "" || dbName == "" {
@@ -1611,7 +1618,14 @@ func deleteBranchHandler(w http.ResponseWriter, r *http.Request) {
1611
1618
w .WriteHeader (http .StatusBadRequest )
1612
1619
return
1613
1620
}
1614
- dbOwner := strings .ToLower (usr )
1621
+
1622
+ // Use the established capitalisation of the username
1623
+ z , err := database .User (usr )
1624
+ if err != nil {
1625
+ w .WriteHeader (http .StatusInternalServerError )
1626
+ return
1627
+ }
1628
+ dbOwner := z .Username
1615
1629
1616
1630
// Check if a branch name was requested
1617
1631
branchName , err := com .GetFormBranch (r )
@@ -2102,7 +2116,14 @@ func deleteCommitHandler(w http.ResponseWriter, r *http.Request) {
2102
2116
w .WriteHeader (http .StatusBadRequest )
2103
2117
return
2104
2118
}
2105
- dbOwner := strings .ToLower (usr )
2119
+
2120
+ // Use the established capitalisation of the username
2121
+ z , err := database .User (usr )
2122
+ if err != nil {
2123
+ w .WriteHeader (http .StatusInternalServerError )
2124
+ return
2125
+ }
2126
+ dbOwner := z .Username
2106
2127
2107
2128
// Validate the supplied commit ID
2108
2129
commit , err := com .GetFormCommit (r )
@@ -2399,7 +2420,14 @@ func deleteDatabaseHandler(w http.ResponseWriter, r *http.Request) {
2399
2420
fmt .Fprint (w , "Validation failed for owner or database name" )
2400
2421
return
2401
2422
}
2402
- dbOwner := strings .ToLower (usr )
2423
+
2424
+ // Use the established capitalisation of the username
2425
+ z , err := database .User (usr )
2426
+ if err != nil {
2427
+ w .WriteHeader (http .StatusInternalServerError )
2428
+ return
2429
+ }
2430
+ dbOwner := z .Username
2403
2431
2404
2432
// If any of the required values were empty, indicate failure
2405
2433
if dbName == "" || dbOwner == "" {
@@ -2517,7 +2545,14 @@ func deleteReleaseHandler(w http.ResponseWriter, r *http.Request) {
2517
2545
w .WriteHeader (http .StatusBadRequest )
2518
2546
return
2519
2547
}
2520
- dbOwner := strings .ToLower (usr )
2548
+
2549
+ // Use the established capitalisation of the username
2550
+ z , err := database .User (usr )
2551
+ if err != nil {
2552
+ w .WriteHeader (http .StatusInternalServerError )
2553
+ return
2554
+ }
2555
+ dbOwner := z .Username
2521
2556
2522
2557
// Ensure a release name was supplied in the tag parameter
2523
2558
relName , err := com .GetFormTag (r )
@@ -2598,7 +2633,14 @@ func deleteTagHandler(w http.ResponseWriter, r *http.Request) {
2598
2633
w .WriteHeader (http .StatusBadRequest )
2599
2634
return
2600
2635
}
2601
- dbOwner := strings .ToLower (usr )
2636
+
2637
+ // Use the established capitalisation of the username
2638
+ z , err := database .User (usr )
2639
+ if err != nil {
2640
+ w .WriteHeader (http .StatusInternalServerError )
2641
+ return
2642
+ }
2643
+ dbOwner := z .Username
2602
2644
2603
2645
// Ensure a tag name was supplied
2604
2646
tagName , err := com .GetFormTag (r )
@@ -4023,7 +4065,14 @@ func saveSettingsHandler(w http.ResponseWriter, r *http.Request) {
4023
4065
errorPage (w , r , http .StatusBadRequest , err .Error ())
4024
4066
return
4025
4067
}
4026
- dbOwner := strings .ToLower (usr )
4068
+
4069
+ // Use the established capitalisation of the username
4070
+ z , err := database .User (usr )
4071
+ if err != nil {
4072
+ w .WriteHeader (http .StatusInternalServerError )
4073
+ return
4074
+ }
4075
+ dbOwner := z .Username
4027
4076
4028
4077
// Make sure a username was given
4029
4078
if len (dbOwner ) == 0 || dbOwner == "" {
@@ -4436,7 +4485,14 @@ func setDefaultBranchHandler(w http.ResponseWriter, r *http.Request) {
4436
4485
w .WriteHeader (http .StatusBadRequest )
4437
4486
return
4438
4487
}
4439
- dbOwner := strings .ToLower (usr )
4488
+
4489
+ // Use the established capitalisation of the username
4490
+ z , err := database .User (usr )
4491
+ if err != nil {
4492
+ w .WriteHeader (http .StatusInternalServerError )
4493
+ return
4494
+ }
4495
+ dbOwner := z .Username
4440
4496
4441
4497
// Check if a branch name was requested
4442
4498
branchName , err := com .GetFormBranch (r )
@@ -4570,7 +4626,14 @@ func tableNamesHandler(w http.ResponseWriter, r *http.Request) {
4570
4626
w .WriteHeader (http .StatusBadRequest )
4571
4627
return
4572
4628
}
4573
- dbOwner := strings .ToLower (usr )
4629
+
4630
+ // Use the established capitalisation of the username
4631
+ z , err := database .User (usr )
4632
+ if err != nil {
4633
+ w .WriteHeader (http .StatusInternalServerError )
4634
+ return
4635
+ }
4636
+ dbOwner := z .Username
4574
4637
4575
4638
// Make sure a branch name was provided
4576
4639
branchName , err := com .GetFormBranch (r )
@@ -4994,7 +5057,14 @@ func updateBranchHandler(w http.ResponseWriter, r *http.Request) {
4994
5057
w .WriteHeader (http .StatusBadRequest )
4995
5058
return
4996
5059
}
4997
- dbOwner := strings .ToLower (usr )
5060
+
5061
+ // Use the established capitalisation of the username
5062
+ z , err := database .User (usr )
5063
+ if err != nil {
5064
+ w .WriteHeader (http .StatusInternalServerError )
5065
+ return
5066
+ }
5067
+ dbOwner := z .Username
4998
5068
4999
5069
// Unescape, then validate the new branch name
5000
5070
a := r .PostFormValue ("newbranch" )
@@ -5137,7 +5207,14 @@ func updateCommentHandler(w http.ResponseWriter, r *http.Request) {
5137
5207
w .WriteHeader (http .StatusBadRequest )
5138
5208
return
5139
5209
}
5140
- dbOwner := strings .ToLower (usr )
5210
+
5211
+ // Use the established capitalisation of the username
5212
+ z , err := database .User (usr )
5213
+ if err != nil {
5214
+ w .WriteHeader (http .StatusInternalServerError )
5215
+ return
5216
+ }
5217
+ dbOwner := z .Username
5141
5218
5142
5219
// Ensure a discussion ID was given
5143
5220
a := r .PostFormValue ("discid" )
@@ -5346,7 +5423,14 @@ func updateDiscussHandler(w http.ResponseWriter, r *http.Request) {
5346
5423
fmt .Fprint (w , "Bad request" )
5347
5424
return
5348
5425
}
5349
- dbOwner := strings .ToLower (usr )
5426
+
5427
+ // Use the established capitalisation of the username
5428
+ z , err := database .User (usr )
5429
+ if err != nil {
5430
+ w .WriteHeader (http .StatusInternalServerError )
5431
+ return
5432
+ }
5433
+ dbOwner := z .Username
5350
5434
5351
5435
// Ensure a discussion ID was given
5352
5436
a := r .PostFormValue ("discid" )
@@ -5456,7 +5540,14 @@ func updateReleaseHandler(w http.ResponseWriter, r *http.Request) {
5456
5540
w .WriteHeader (http .StatusBadRequest )
5457
5541
return
5458
5542
}
5459
- dbOwner := strings .ToLower (usr )
5543
+
5544
+ // Use the established capitalisation of the username
5545
+ z , err := database .User (usr )
5546
+ if err != nil {
5547
+ w .WriteHeader (http .StatusInternalServerError )
5548
+ return
5549
+ }
5550
+ dbOwner := z .Username
5460
5551
5461
5552
// Validate new release name
5462
5553
a := r .PostFormValue ("newtag" )
@@ -5570,7 +5661,14 @@ func updateTagHandler(w http.ResponseWriter, r *http.Request) {
5570
5661
w .WriteHeader (http .StatusBadRequest )
5571
5662
return
5572
5663
}
5573
- dbOwner := strings .ToLower (usr )
5664
+
5665
+ // Use the established capitalisation of the username
5666
+ z , err := database .User (usr )
5667
+ if err != nil {
5668
+ w .WriteHeader (http .StatusInternalServerError )
5669
+ return
5670
+ }
5671
+ dbOwner := z .Username
5574
5672
5575
5673
// Validate new tag name
5576
5674
a := r .PostFormValue ("newtag" )
0 commit comments