Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CurlDownloadStrategy#_fetch: do not alter variable @url #504

Merged
merged 1 commit into from
Jul 13, 2016
Merged

CurlDownloadStrategy#_fetch: do not alter variable @url #504

merged 1 commit into from
Jul 13, 2016

Conversation

xu-cheng
Copy link
Contributor

@xu-cheng xu-cheng commented Jul 13, 2016

In case of download failure and retry, altering @url can cause side
effect like repeatedly applying HOMEBREW_ARTIFACT_DOMAIN.

@BrewTestBot BrewTestBot added the in progress Maintainers are working on this label Jul 13, 2016
In case of download failure and retry, altering `@url` can cause side
effect like repeatedly applying `HOMEBREW_ARTIFACT_DOMAIN`.
@MikeMcQuaid
Copy link
Member

👍

@xu-cheng xu-cheng merged commit ed9bb44 into Homebrew:master Jul 13, 2016
@xu-cheng xu-cheng deleted the downloader branch July 13, 2016 12:56
@BrewTestBot BrewTestBot removed the in progress Maintainers are working on this label Jul 13, 2016
if ENV["HOMEBREW_ARTIFACT_DOMAIN"]
@url.sub!(%r{^((ht|f)tps?://)?}, ENV["HOMEBREW_ARTIFACT_DOMAIN"].chomp("/") + "/")
ohai "Downloading from #{@url}"
url.sub!(%r{^((ht|f)tps?://)?}, ENV["HOMEBREW_ARTIFACT_DOMAIN"].chomp("/") + "/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this still indirectly modifying @url as url is referencing the same String instance? If so, this should be fixable by doing url = @url.dup or (probably better) by using String#sub here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

souvik1997 pushed a commit to souvik1997/brew that referenced this pull request Jul 25, 2016
In case of download failure and retry, altering `@url` can cause side
effect like repeatedly applying `HOMEBREW_ARTIFACT_DOMAIN`.
@Homebrew Homebrew locked and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants