Allow uppercase package name in package query expressions

Fixes: #636

Before this fix, aptly was always treating strings starting with
uppercase letter as field name, which was breaking package queries
like `VMware-Horizon-Client_4.5.0_all`.

Now aptly accepts only fields which don't contain underscore, and
everything else would be parsed as package reference.
This commit is contained in:
Andrey Smirnov
2017-09-18 21:36:06 +03:00
parent 985f1a17b5
commit 50035d5bc4
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ func (p *parser) D() deb.PackageQuery {
operator, value := p.Condition()
r, _ := utf8.DecodeRuneInString(field)
if strings.HasPrefix(field, "$") || unicode.IsUpper(r) {
if strings.HasPrefix(field, "$") || (unicode.IsUpper(r) && !strings.ContainsRune(field, '_')) {
// special field or regular field
q := &deb.FieldQuery{Field: field, Relation: operatorToRelation(operator), Value: value}
if q.Relation == deb.VersionRegexp {