mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-05-17 02:27:10 +02:00
Merge branch 'main' into std-http
This commit is contained in:
commit
e1c78d6069
17 changed files with 138 additions and 79 deletions
|
@ -16,8 +16,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
giteaAPIRepos = "/api/v1/repos/"
|
||||
giteaObjectTypeHeader = "X-Gitea-Object-Type"
|
||||
giteaAPIRepos = "/api/v1/repos/"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
|
@ -71,7 +70,10 @@ func (client *Client) ServeRawContent(targetOwner, targetRepo, ref, resource str
|
|||
|
||||
switch resp.StatusCode() {
|
||||
case fasthttp.StatusOK:
|
||||
if client.followSymlinks && string(resp.Header.Peek(giteaObjectTypeHeader)) == "symlink" {
|
||||
objType := string(resp.Header.Peek(giteaObjectTypeHeader))
|
||||
log.Trace().Msgf("server raw content object: %s", objType)
|
||||
if client.followSymlinks && objType == "symlink" {
|
||||
// TODO: limit to 1000 chars if we switched to std
|
||||
linkDest := strings.TrimSpace(string(resp.Body()))
|
||||
log.Debug().Msgf("follow symlink from '%s' to '%s'", resource, linkDest)
|
||||
return client.ServeRawContent(targetOwner, targetRepo, ref, linkDest)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue