mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Avoid wrapping strings.Replace in Contains (#1710)
The strings.Replace function counts the number of replacements. If 0, the original string is returned. Hence, there is no need to check if a replacement will happen before doing the work.
This commit is contained in:
@@ -32,10 +32,8 @@ func (s mappedConfig) applyCommon(c commonMappedConfig, src string) string {
|
||||
|
||||
ret := src
|
||||
for commonKey, commonVal := range c {
|
||||
if strings.Contains(ret, commonKey) {
|
||||
ret = strings.Replace(ret, commonKey, commonVal, -1)
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user