File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,10 @@ func CreateFile(ctx *context.APIContext, apiOpts api.CreateFileOptions) {
199199 // "201":
200200 // "$ref": "#/responses/FileResponse"
201201
202+ if apiOpts .BranchName == "" {
203+ apiOpts .BranchName = ctx .Repo .Repository .DefaultBranch
204+ }
205+
202206 opts := & repofiles.UpdateRepoFileOptions {
203207 Content : apiOpts .Content ,
204208 IsNewFile : true ,
@@ -271,6 +275,10 @@ func UpdateFile(ctx *context.APIContext, apiOpts api.UpdateFileOptions) {
271275 // "200":
272276 // "$ref": "#/responses/FileResponse"
273277
278+ if apiOpts .BranchName == "" {
279+ apiOpts .BranchName = ctx .Repo .Repository .DefaultBranch
280+ }
281+
274282 opts := & repofiles.UpdateRepoFileOptions {
275283 Content : apiOpts .Content ,
276284 SHA : apiOpts .SHA ,
@@ -377,6 +385,10 @@ func DeleteFile(ctx *context.APIContext, apiOpts api.DeleteFileOptions) {
377385 return
378386 }
379387
388+ if apiOpts .BranchName == "" {
389+ apiOpts .BranchName = ctx .Repo .Repository .DefaultBranch
390+ }
391+
380392 opts := & repofiles.DeleteRepoFileOptions {
381393 Message : apiOpts .Message ,
382394 OldBranch : apiOpts .BranchName ,
You can’t perform that action at this time.
0 commit comments