@@ -72,6 +72,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
72
72
err := models .NewRepoRedirect (ctx .Repo .Owner .ID , repo .ID , repo .Name , newRepoName )
73
73
if err != nil {
74
74
ctx .Handle (500 , "NewRepoRedirect" , err )
75
+ return
75
76
}
76
77
77
78
log .Trace ("Repository name changed: %s/%s -> %s" , ctx .Repo .Owner .Name , repo .Name , newRepoName )
@@ -151,6 +152,12 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
151
152
152
153
if form .EnableWiki {
153
154
if form .EnableExternalWiki {
155
+ if ! strings .HasPrefix (form .ExternalWikiURL , "http://" ) && ! strings .HasPrefix (form .ExternalWikiURL , "https://" ) {
156
+ ctx .Flash .Error (ctx .Tr ("repo.settings.external_wiki_url_error" ))
157
+ ctx .Redirect (repo .Link () + "/settings" )
158
+ return
159
+ }
160
+
154
161
units = append (units , models.RepoUnit {
155
162
RepoID : repo .ID ,
156
163
Type : models .UnitTypeExternalWiki ,
@@ -171,10 +178,15 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
171
178
172
179
if form .EnableIssues {
173
180
if form .EnableExternalTracker {
181
+ if ! strings .HasPrefix (form .ExternalTrackerURL , "http://" ) && ! strings .HasPrefix (form .ExternalTrackerURL , "https://" ) {
182
+ ctx .Flash .Error (ctx .Tr ("repo.settings.external_tracker_url_error" ))
183
+ ctx .Redirect (repo .Link () + "/settings" )
184
+ return
185
+ }
174
186
units = append (units , models.RepoUnit {
175
187
RepoID : repo .ID ,
176
- Type : models .UnitTypeExternalWiki ,
177
- Index : int (models .UnitTypeExternalWiki ),
188
+ Type : models .UnitTypeExternalTracker ,
189
+ Index : int (models .UnitTypeExternalTracker ),
178
190
Config : & models.ExternalTrackerConfig {
179
191
ExternalTrackerURL : form .ExternalTrackerURL ,
180
192
ExternalTrackerFormat : form .TrackerURLFormat ,
0 commit comments