Sfoglia il codice sorgente

make branch parameter optional for /api/v1/repos/{owner}/{repo}/contents/{filepath} (#11067)

tags/v1.13.0-dev
6543 4 anni fa
parent
commit
b9ed8d8497
Nessun account collegato all'indirizzo email del committer
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  1. 12
    0
      routers/api/v1/repo/file.go

+ 12
- 0
routers/api/v1/repo/file.go Vedi File

@@ -199,6 +199,10 @@ func CreateFile(ctx *context.APIContext, apiOpts api.CreateFileOptions) {
// "201":
// "$ref": "#/responses/FileResponse"

if apiOpts.BranchName == "" {
apiOpts.BranchName = ctx.Repo.Repository.DefaultBranch
}

opts := &repofiles.UpdateRepoFileOptions{
Content: apiOpts.Content,
IsNewFile: true,
@@ -271,6 +275,10 @@ func UpdateFile(ctx *context.APIContext, apiOpts api.UpdateFileOptions) {
// "200":
// "$ref": "#/responses/FileResponse"

if apiOpts.BranchName == "" {
apiOpts.BranchName = ctx.Repo.Repository.DefaultBranch
}

opts := &repofiles.UpdateRepoFileOptions{
Content: apiOpts.Content,
SHA: apiOpts.SHA,
@@ -377,6 +385,10 @@ func DeleteFile(ctx *context.APIContext, apiOpts api.DeleteFileOptions) {
return
}

if apiOpts.BranchName == "" {
apiOpts.BranchName = ctx.Repo.Repository.DefaultBranch
}

opts := &repofiles.DeleteRepoFileOptions{
Message: apiOpts.Message,
OldBranch: apiOpts.BranchName,

Loading…
Annulla
Salva