mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-12-04 18:36:26 +00:00
Regex arguments should be escaped
This commit is contained in:
parent
3f4c4ad211
commit
e889daa21f
@ -8,21 +8,21 @@ import (
|
||||
)
|
||||
|
||||
func GetTagImportRegex(pd *data.ProcessData) *regexp.Regexp {
|
||||
branchRegex := fmt.Sprintf("%s%d%s", pd.ImportBranchPrefix, pd.Version, pd.BranchSuffix)
|
||||
branchRegex := regexp.QuoteMeta(fmt.Sprintf("%s%d%s", pd.ImportBranchPrefix, pd.Version, pd.BranchSuffix))
|
||||
if !pd.StrictBranchMode {
|
||||
branchRegex += "(?:.+|)"
|
||||
} else {
|
||||
branchRegex += "(?:-stream-.+|)"
|
||||
}
|
||||
|
||||
initialVerRegex := filepath.Base(pd.RpmLocation) + "-"
|
||||
initialVerRegex := regexp.QuoteMeta(filepath.Base(pd.RpmLocation)) + "-"
|
||||
if pd.PackageVersion != "" {
|
||||
initialVerRegex += pd.PackageVersion + "-"
|
||||
initialVerRegex += regexp.QuoteMeta(pd.PackageVersion) + "-"
|
||||
} else {
|
||||
initialVerRegex += ".+-"
|
||||
}
|
||||
if pd.PackageRelease != "" {
|
||||
initialVerRegex += pd.PackageRelease
|
||||
initialVerRegex += regexp.QuoteMeta(pd.PackageRelease)
|
||||
} else {
|
||||
initialVerRegex += ".+"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user