Centralize managed state targets

This commit is contained in:
2026-05-31 03:17:40 +00:00
parent 4bd5b19025
commit 61a40ab656
10 changed files with 116 additions and 43 deletions

View File

@@ -4,6 +4,8 @@ import (
"os"
"strings"
"testing"
"gitea.maximumdirect.net/eric/distributor/internal/storage"
)
func TestParseManifestValid(t *testing.T) {
@@ -71,7 +73,7 @@ func TestParseManifestRejectsUnsafeFilePaths(t *testing.T) {
`"path": "/report.md"`,
`"path": "nested/../report.md"`,
`"path": "manifest.json"`,
`"path": ".distributor.json"`,
`"path": "` + storage.StateFileName + `"`,
}
for _, replacement := range tests {
t.Run(replacement, func(t *testing.T) {

View File

@@ -12,7 +12,7 @@ func ValidateSourcePath(path string) error {
return err
}
switch path {
case ManifestName, ".distributor.json":
case ManifestName, storage.StateFileName:
return fmt.Errorf("%q is reserved", path)
}
return nil