0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-06-07 08:55:14 +02:00

fix(actions): return 404 when job log blob is missing (#38003)

- When the `action_task` row exists but the underlying dbfs/storage blob
is gone, `OpenLogs` returns a wrapped `os.ErrNotExist` which surfaces as
a 500 on the job logs endpoints.
- Translate it to the same `util.NewNotExistErrorf` shape already used
for unknown job ids / expired logs, so both the API
(`/api/v1/repos/.../actions/jobs/<id>/logs`) and the web download
handler return a clean 404 instead.

Fixes #37990.
This commit is contained in:
bircni 2026-06-05 20:10:25 +02:00 committed by GitHub
parent 7a26d5a2ae
commit aa63d1583d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,9 @@
package common
import (
"errors"
"fmt"
"io/fs"
"strings"
actions_model "gitea.dev/models/actions"
@ -51,6 +53,9 @@ func DownloadActionsRunJobLogs(ctx *context.Base, ctxRepo *repo_model.Repository
reader, err := actions.OpenLogs(ctx, task.LogInStorage, task.LogFilename)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return util.NewNotExistErrorf("logs not found")
}
return fmt.Errorf("OpenLogs: %w", err)
}
defer reader.Close()