Fix "path.Clean" behavior to take arch-specific Directory values into account too

This commit is contained in:
Tianon Gravi 2019-06-18 16:18:28 -07:00
parent 7d4d3222cd
commit ab12b4904b
1 changed files with 9 additions and 1 deletions

View File

@ -89,6 +89,14 @@ func (entry *Manifest2822Entry) SeedArchValues() {
}
}
}
func (entry *Manifest2822Entry) CleanDirectoryValues() {
entry.Directory = path.Clean(entry.Directory)
for field, val := range entry.ArchValues {
if strings.HasSuffix(field, "-Directory") && val != "" {
entry.ArchValues[field] = path.Clean(val)
}
}
}
const StringSeparator2822 = ", "
@ -385,7 +393,7 @@ func (manifest *Manifest2822) AddEntry(entry Manifest2822Entry) error {
}
entry.DeduplicateSharedTags()
entry.Directory = path.Clean(entry.Directory)
entry.CleanDirectoryValues()
if invalidArchitectures := entry.InvalidArchitectures(); len(invalidArchitectures) > 0 {
return fmt.Errorf("Tags %q has invalid Architectures: %q", entry.TagsString(), strings.Join(invalidArchitectures, ", "))