mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-23 05:00:02 +02:00
Use url.PathEscape to escape the branchname (#6304)
* Use url.PathEscape to escape the branchname * GetRepositoryByOwnerAndName should also have url.PathEscape as the owner and reponame are provided by the client
This commit is contained in:
parent
50631b5ac3
commit
663874e8be
2 changed files with 4 additions and 2 deletions
|
@ -7,6 +7,7 @@ package private
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -16,7 +17,7 @@ import (
|
|||
// GetProtectedBranchBy get protected branch information
|
||||
func GetProtectedBranchBy(repoID int64, branchName string) (*models.ProtectedBranch, error) {
|
||||
// Ask for running deliver hook and test pull request tasks.
|
||||
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/branch/%d/%s", repoID, branchName)
|
||||
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/branch/%d/%s", repoID, url.PathEscape(branchName))
|
||||
log.GitLogger.Trace("GetProtectedBranchBy: %s", reqURL)
|
||||
|
||||
resp, err := newInternalRequest(reqURL, "GET").Response()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue