BazaarDownloadStrategy: Replace in-place sub

livecheck's `Git` strategy uses `DownloadStrategyDetector#detect`
in its `#match?` method to check if a URL is a Git repository. This
has historically worked fine but I've recently seen a `can't modify
frozen String` error for a few formulae (percona-toolkit,
schroedinger, squid) in relation to the in-place `sub` call in
`BazaarDownloadStrategy`'s initializer.

Other download strategies use a `@url = @url.sub(...)` pattern to
avoid this issue, so this commit resolves the issue by using the same
approach in `BazaarDownloadStrategy`.
This commit is contained in:
Sam Ford 2023-05-01 10:45:13 -04:00
parent 01e0c20d01
commit ec2a7121ab
No known key found for this signature in database
GPG Key ID: 7AF5CBEE1DD6F76D

View File

@ -1277,7 +1277,7 @@ end
class BazaarDownloadStrategy < VCSDownloadStrategy class BazaarDownloadStrategy < VCSDownloadStrategy
def initialize(url, name, version, **meta) def initialize(url, name, version, **meta)
super super
@url.sub!(%r{^bzr://}, "") @url = @url.sub(%r{^bzr://}, "")
end end
# @see AbstractDownloadStrategy#source_modified_time # @see AbstractDownloadStrategy#source_modified_time