loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add support for action artifact serve direct (#29120)

Fixes #29093

(cherry picked from commit 07597c71a4b6642beae7589c678603f4846f7920)

authored by

KN4CK3R and committed by
Earl Warren
1f8ad34e 7474f628

+14 -1
+14 -1
routers/api/actions/artifacts.go
··· 63 63 64 64 import ( 65 65 "crypto/md5" 66 + "errors" 66 67 "fmt" 67 68 "net/http" 68 69 "strconv" ··· 426 427 427 428 var items []downloadArtifactResponseItem 428 429 for _, artifact := range artifacts { 429 - downloadURL := ar.buildArtifactURL(runID, strconv.FormatInt(artifact.ID, 10), "download") 430 + var downloadURL string 431 + if setting.Actions.ArtifactStorage.MinioConfig.ServeDirect { 432 + u, err := ar.fs.URL(artifact.StoragePath, artifact.ArtifactName) 433 + if err != nil && !errors.Is(err, storage.ErrURLNotSupported) { 434 + log.Error("Error getting serve direct url: %v", err) 435 + } 436 + if u != nil { 437 + downloadURL = u.String() 438 + } 439 + } 440 + if downloadURL == "" { 441 + downloadURL = ar.buildArtifactURL(runID, strconv.FormatInt(artifact.ID, 10), "download") 442 + } 430 443 item := downloadArtifactResponseItem{ 431 444 Path: util.PathJoinRel(itemPath, artifact.ArtifactPath), 432 445 ItemType: "file",