Merge pull request #12177 from Bo98/curl-flag

utils/curl: fix flag handling
This commit is contained in:
Bo Anderson 2021-10-04 18:05:27 +01:00 committed by GitHub
commit 373b0da4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,7 +304,13 @@ module Utils
)
file = Tempfile.new.tap(&:close)
specs = specs.flat_map { |option, argument| ["--#{option.to_s.tr("_", "-")}", argument] }
specs = specs.flat_map do |option, argument|
next if argument == false # No flag.
args = ["--#{option.to_s.tr("_", "-")}"]
args << argument unless argument == true # It's a flag.
args
end
max_time = hash_needed ? 600 : 25
output, _, status = curl_output(
*specs, "--dump-header", "-", "--output", file.path, "--location", url,