mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Don't allow '/' in distribution name, auto-replace '/' with '-' while guessing. #110
This commit is contained in:
@@ -168,6 +168,9 @@ func NewPublishedRepo(storage, prefix, distribution string, architectures []stri
|
||||
if distribution == "" || component == "" {
|
||||
rootDistributions, rootComponents := walkUpTree(source, collectionFactory)
|
||||
if distribution == "" {
|
||||
for i := range rootDistributions {
|
||||
rootDistributions[i] = strings.Replace(rootDistributions[i], "/", "-", -1)
|
||||
}
|
||||
discoveredDistributions = append(discoveredDistributions, rootDistributions...)
|
||||
}
|
||||
if component == "" {
|
||||
@@ -227,6 +230,10 @@ func NewPublishedRepo(storage, prefix, distribution string, architectures []stri
|
||||
}
|
||||
}
|
||||
|
||||
if strings.Index(distribution, "/") != -1 {
|
||||
return nil, fmt.Errorf("invalid distribution %s, '/' is not allowed", distribution)
|
||||
}
|
||||
|
||||
result.Distribution = distribution
|
||||
|
||||
return result, nil
|
||||
|
||||
Reference in New Issue
Block a user