Centralize managed state targets
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user