Merge pull request #7532 from Bo98/bintray-url-encode

bintray: url encode where needed
This commit is contained in:
Bo Anderson 2020-05-10 21:53:37 +01:00 committed by GitHub
commit c0f5a52d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -106,12 +106,12 @@ class Bintray
formula_packaged = {}
bottles_hash.each do |formula_name, bottle_hash|
version = bottle_hash["formula"]["pkg_version"]
version = ERB::Util.url_encode(bottle_hash["formula"]["pkg_version"])
bintray_package = bottle_hash["bintray"]["package"]
bintray_repo = bottle_hash["bintray"]["repository"]
bottle_hash["bottle"]["tags"].each do |_tag, tag_hash|
filename = tag_hash["filename"]
filename = tag_hash["filename"] # URL encoded in Bottle::Filename#bintray
sha256 = tag_hash["sha256"]
odebug "Checking remote file #{@bintray_org}/#{bintray_repo}/#{filename}"
@ -132,7 +132,7 @@ class Bintray
formula_packaged[formula_name] = true
end
odebug "Uploading #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}/#{tag_hash["local_filename"]}"
odebug "Uploading #{@bintray_org}/#{bintray_repo}/#{bintray_package}/#{version}/#{filename}"
upload(tag_hash["local_filename"],
repo: bintray_repo,
package: bintray_package,

View File

@ -41,20 +41,21 @@ module Homebrew
downloader.fetch
filename = downloader.basename
filename = ERB::Util.url_encode(downloader.basename)
destination_url = "https://dl.bintray.com/#{bintray_org}/#{bintray_repo}/#{filename}"
ohai "Uploading to #{destination_url}"
version = ERB::Util.url_encode(f.pkg_version)
bintray.upload(
downloader.cached_location,
repo: bintray_repo,
package: bintray_package,
version: f.pkg_version,
version: version,
sha256: f.stable.checksum,
remote_file: filename,
)
bintray.publish(repo: bintray_repo, package: bintray_package, version: f.pkg_version)
bintray.publish(repo: bintray_repo, package: bintray_package, version: version)
ohai "Mirrored #{filename}!"
end
end

View File

@ -274,7 +274,7 @@ class Bottle
end
def bintray
"#{name}-#{version}#{extname}"
ERB::Util.url_encode("#{name}-#{version}#{extname}")
end
def extname