mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-25 14:26:58 +00:00
wip
This commit is contained in:
parent
9a44e26da7
commit
6bc79e5ebf
2 changed files with 49 additions and 5 deletions
|
@ -93,7 +93,7 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
// tryBranch checks if a branch exists and populates the target variables. If canonicalLink is non-empty, it will
|
||||
// also disallow search indexing and add a Link header to the canonical URL.
|
||||
// TODO: move into external func to not alert vars indirectly
|
||||
tryBranch := func(log zerolog.Logger, repo, branch string, _path []string, canonicalLink string) bool {
|
||||
tryBranch1 := func(log zerolog.Logger, repo, branch string, _path []string, canonicalLink string) bool {
|
||||
if repo == "" {
|
||||
log.Debug().Msg("tryBranch: repo == ''")
|
||||
return false
|
||||
|
@ -150,13 +150,14 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
// raw.codeberg.org/example/myrepo/@main/index.html
|
||||
if len(pathElements) > 2 && strings.HasPrefix(pathElements[2], "@") {
|
||||
log.Debug().Msg("raw domain preparations, now trying with specified branch")
|
||||
if tryBranch(log,
|
||||
targetRepo, pathElements[2][1:], pathElements[3:],
|
||||
if newRepo, newPath, newBranch, newTimestamp, works := tryBranch2(log, ctx, giteaClient,
|
||||
targetOwner, targetRepo, pathElements[2][1:], pathElements[3:],
|
||||
giteaRoot+"/"+targetOwner+"/"+targetRepo+"/src/branch/%b/%p",
|
||||
) {
|
||||
); works {
|
||||
targetOptions.BranchTimestamp = *newTimestamp
|
||||
log.Debug().Msg("tryBranch, now trying upstream 1")
|
||||
tryUpstream(ctx, giteaClient, mainDomainSuffix, trimmedHost,
|
||||
targetOptions, targetOwner, targetRepo, targetBranch, targetPath,
|
||||
targetOptions, targetOwner, newRepo, newBranch, newPath,
|
||||
canonicalDomainCache)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue