GetFile: Use "ref" in-query if posible #491
No reviewers
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#491
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "6543/go-sdk:GetFile_use-ref_in-query_if-posible"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
based on https://github.com/go-gitea/gitea/pull/14563
6543 referenced this pull request2021-02-16 15:28:01 +00:00
@ -122,0 +121,4 @@
if c.checkServerVersionGreaterThanOrEqual(version1_14_0) != nil {
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", owner, repo, ref, tree), nil, nil)
}
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s?ref=%s", owner, repo, tree, ref), nil, nil)
tree and ref should both be escaped properly.
ref is simple as it's url.QueryEscape but tree needs escaping using the partial pathescape.
@ -122,0 +122,4 @@
if c.checkServerVersionGreaterThanOrEqual(version1_14_0) != nil {
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", owner, repo, ref, tree), nil, nil)
}
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s?ref=%s", owner, repo, tree, url.QueryEscape(ref)), nil, nil)
tree needs to be
util.PathEscapeSegments
or something like it.e.g. from Gitea modules/util
as does ref and tree on line 123
this is a more genneral issue witch I like to catch with #273 since we need this not only for this function...