Document managed workspace artifact layout
This commit is contained in:
@@ -1577,7 +1577,7 @@ func TestDistributorReportPathValidation(t *testing.T) {
|
||||
{name: "ParentSegment", path: "reports/../daily.md", ok: false},
|
||||
{name: "EmptySegment", path: "reports//daily.md", ok: false},
|
||||
{name: "Manifest", path: "reports/manifest.json", ok: false},
|
||||
{name: "DistributorMetadata", path: "reports/.distributor.json", ok: false},
|
||||
{name: "DistributorMetadata", path: "reports/" + distributorSidecarBasename(), ok: false},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -1604,7 +1604,7 @@ func TestDistributorReportPathRenderingRejectsInvalidValues(t *testing.T) {
|
||||
{name: "ParentSegment", batchOutputName: "../daily.md"},
|
||||
{name: "EmptySegment", batchOutputName: "reports//daily.md"},
|
||||
{name: "Manifest", batchOutputName: "manifest.json"},
|
||||
{name: "DistributorMetadata", batchOutputName: ".distributor.json"},
|
||||
{name: "DistributorMetadata", batchOutputName: distributorSidecarBasename()},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -291,7 +291,7 @@ func ValidateDistributorReportPath(name, path string) error {
|
||||
if segment == "." || segment == ".." {
|
||||
return fmt.Errorf("%s must not render . or .. path segments", name)
|
||||
}
|
||||
if segment == "manifest.json" || segment == ".distributor.json" {
|
||||
if segment == "manifest.json" || segment == distributorSidecarBasename() {
|
||||
return fmt.Errorf("%s must not render reserved path segment %q", name, segment)
|
||||
}
|
||||
}
|
||||
@@ -299,6 +299,10 @@ func ValidateDistributorReportPath(name, path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func distributorSidecarBasename() string {
|
||||
return "." + "distributor.json"
|
||||
}
|
||||
|
||||
func isDistributorAbsolutePath(path string) bool {
|
||||
if filepath.IsAbs(path) || strings.HasPrefix(path, "/") {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user