Replace 'export_file' by 'http' to download Google Sheet files

pull/15903/head
cgonzalez 4 years ago
parent eea39905f3
commit b5738e1d45

@ -16,6 +16,7 @@ Development
* Fix Dashboard/Data navigation for free users. Update Data preview texts [#15892](https://github.com/CartoDB/cartodb/pull/15892)
* Force CTE materialization in Ghost Tables query to improve performance [#15895](https://github.com/CartoDB/cartodb/pull/15895)
* Adapt default Rails mail logs to JSON format [#15894](https://github.com/CartoDB/cartodb/pull/15894)
* Fix export of Google Sheet files larger than 10MB []()
4.42.0 (2020-09-28)
-------------------

@ -193,22 +193,25 @@ module CartoDB
raise DataDownloadError.new(error_msg, DATASOURCE_NAME)
end
if file.export_links.present?
@drive.export_file(file.id, 'text/csv', download_dest: StringIO.new) do |content, export_err|
@drive.http(:get, file.export_links['text/csv'], download_dest: StringIO.new) do |content, export_err|
raise export_err if export_err
return content
# NOTE: Reinitializing StringIO due to 'content' is not readable
return StringIO.new(content.string)
end
else
@drive.get_file(file.id, download_dest: StringIO.new) do |content, download_err|
raise download_err if download_err
return content
end
end
end
rescue Google::Apis::AuthorizationError, Signet::AuthorizationError => ex
raise TokenExpiredOrInvalidError.new("Invalid token: #{ex.message}", DATASOURCE_NAME)
rescue Google::Apis::AuthorizationError, Signet::AuthorizationError => e
raise TokenExpiredOrInvalidError.new("Invalid token: #{e.message}", DATASOURCE_NAME)
rescue Google::Apis::BatchError, Google::Apis::TransmissionError, Google::Apis::ClientError, \
Google::Apis::ServerError => ex
raise DataDownloadError.new("downloading file #{id}: #{ex.message}", DATASOURCE_NAME)
Google::Apis::ServerError => e
raise DataDownloadError.new("downloading file #{id}: #{e.message}", DATASOURCE_NAME)
end
# @param id string

Loading…
Cancel
Save