From 35058f7e8e90884fbb977f359e110e37abd7f4a0 Mon Sep 17 00:00:00 2001 From: Syphax Bouazzouni Date: Mon, 21 Mar 2022 18:00:52 +0100 Subject: [PATCH] update the regex of extracting the file name from the response header --- lib/ontologies_linked_data/utils/file.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ontologies_linked_data/utils/file.rb b/lib/ontologies_linked_data/utils/file.rb index 02cfae14..56f04120 100644 --- a/lib/ontologies_linked_data/utils/file.rb +++ b/lib/ontologies_linked_data/utils/file.rb @@ -110,7 +110,9 @@ def self.download_file(uri, limit = 10) file_size = res.read_header["content-length"].to_i begin - filename = res.read_header["content-disposition"].match(/filename=\"(.*)\"/)[1] if filename.nil? + content_disposition = res.read_header['content-disposition'] + filenames = content_disposition.match(/filename=\"(.*)\"/) || content_disposition.match(/filename=(.*)/) + filename = filenames[1] if filename.nil? rescue filename = LinkedData::Utils::Triples.last_iri_fragment(uri.request_uri) if filename.nil? end