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 {
|
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 {
|
if !pd.StrictBranchMode {
|
||||||
branchRegex += "(?:.+|)"
|
branchRegex += "(?:.+|)"
|
||||||
} else {
|
} else {
|
||||||
branchRegex += "(?:-stream-.+|)"
|
branchRegex += "(?:-stream-.+|)"
|
||||||
}
|
}
|
||||||
|
|
||||||
initialVerRegex := filepath.Base(pd.RpmLocation) + "-"
|
initialVerRegex := regexp.QuoteMeta(filepath.Base(pd.RpmLocation)) + "-"
|
||||||
if pd.PackageVersion != "" {
|
if pd.PackageVersion != "" {
|
||||||
initialVerRegex += pd.PackageVersion + "-"
|
initialVerRegex += regexp.QuoteMeta(pd.PackageVersion) + "-"
|
||||||
} else {
|
} else {
|
||||||
initialVerRegex += ".+-"
|
initialVerRegex += ".+-"
|
||||||
}
|
}
|
||||||
if pd.PackageRelease != "" {
|
if pd.PackageRelease != "" {
|
||||||
initialVerRegex += pd.PackageRelease
|
initialVerRegex += regexp.QuoteMeta(pd.PackageRelease)
|
||||||
} else {
|
} else {
|
||||||
initialVerRegex += ".+"
|
initialVerRegex += ".+"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user