mirror of
https://github.com/stashapp/stash.git
synced 2026-04-25 16:35:21 +02: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:
parent
4b00d24248
commit
82a41e17c7
1 changed files with 1 additions and 3 deletions
|
|
@ -32,9 +32,7 @@ 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)
|
||||
}
|
||||
ret = strings.Replace(ret, commonKey, commonVal, -1)
|
||||
}
|
||||
|
||||
return ret
|
||||
|
|
|
|||
Loading…
Reference in a new issue