mirror of
https://github.com/go-gitea/gitea
synced 2024-11-16 17:59:41 +01:00
parent
702a876453
commit
07597c71a4
@ -63,6 +63,7 @@ package actions
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -426,7 +427,19 @@ func (ar artifactRoutes) getDownloadArtifactURL(ctx *ArtifactContext) {
|
|||||||
|
|
||||||
var items []downloadArtifactResponseItem
|
var items []downloadArtifactResponseItem
|
||||||
for _, artifact := range artifacts {
|
for _, artifact := range artifacts {
|
||||||
downloadURL := ar.buildArtifactURL(runID, strconv.FormatInt(artifact.ID, 10), "download")
|
var downloadURL string
|
||||||
|
if setting.Actions.ArtifactStorage.MinioConfig.ServeDirect {
|
||||||
|
u, err := ar.fs.URL(artifact.StoragePath, artifact.ArtifactName)
|
||||||
|
if err != nil && !errors.Is(err, storage.ErrURLNotSupported) {
|
||||||
|
log.Error("Error getting serve direct url: %v", err)
|
||||||
|
}
|
||||||
|
if u != nil {
|
||||||
|
downloadURL = u.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if downloadURL == "" {
|
||||||
|
downloadURL = ar.buildArtifactURL(runID, strconv.FormatInt(artifact.ID, 10), "download")
|
||||||
|
}
|
||||||
item := downloadArtifactResponseItem{
|
item := downloadArtifactResponseItem{
|
||||||
Path: util.PathJoinRel(itemPath, artifact.ArtifactPath),
|
Path: util.PathJoinRel(itemPath, artifact.ArtifactPath),
|
||||||
ItemType: "file",
|
ItemType: "file",
|
||||||
|
Loading…
Reference in New Issue
Block a user