Validate published output declarations
This commit is contained in:
@@ -210,15 +210,11 @@ func committedPublishedArtifactBySource(commit *artifacts.RemoteCommitManifest,
|
||||
}
|
||||
|
||||
func publishedOutputRelativePath(sessionPrefix, destinationKey string) (string, error) {
|
||||
identity, err := artifacts.ParseImmutableRunObjectKey(sessionPrefix, destinationKey)
|
||||
identity, err := artifacts.ParsePublishedOutputObjectKey(sessionPrefix, destinationKey)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
rel, ok := strings.CutPrefix(identity.RelativePath, "published/")
|
||||
if !ok || strings.TrimSpace(rel) == "" {
|
||||
return "", fmt.Errorf("destination %q is outside its immutable run published-output prefix", destinationKey)
|
||||
}
|
||||
normalized, err := pathsafe.NormalizeRelativeDestination(rel)
|
||||
normalized, err := pathsafe.NormalizeRelativeDestination(identity.Destination)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("published output destination %q: %w", destinationKey, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user