From 15b68ab28d690919ae85189581256c7de729bc08 Mon Sep 17 00:00:00 2001 From: guyyosan Date: Tue, 2 Jun 2020 20:15:16 +0300 Subject: [PATCH] type from url query --- lib/cocoapods-downloader/remote_file.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/cocoapods-downloader/remote_file.rb b/lib/cocoapods-downloader/remote_file.rb index 2721cc3..27ed722 100644 --- a/lib/cocoapods-downloader/remote_file.rb +++ b/lib/cocoapods-downloader/remote_file.rb @@ -58,6 +58,29 @@ def should_flatten? def type_with_url(url) case URI.parse(url).path + when /\.zip$/ + :zip + when /\.(tgz|tar\.gz)$/ + :tgz + when /\.tar$/ + :tar + when /\.(tbz|tar\.bz2)$/ + :tbz + when /\.(txz|tar\.xz)$/ + :txz + when /\.dmg$/ + :dmg + else + type_with_url_query(url) + end + end + + def type_with_url_query(url) + query = URI.parse(url).query + puts(query) + query_params = URI::decode_www_form(query).to_h + puts(query_params) + case query_params['file_path'] when /\.zip$/ :zip when /\.(tgz|tar\.gz)$/