Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/CDB-627' into release/2.…
Browse files Browse the repository at this point in the history
…3.0+
  • Loading branch information
rafacas committed Oct 11, 2013
2 parents e5ed889 + 7f4e427 commit bbfed80
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/common
Submodule common updated 1 files
+6 −7 header.css.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<span class="sync <%= state %>">
<span class="circle"></span>
<div class="circle">
<span class="pulse"></span>
</div>
<p>
<% if (state != "failure") { %>
synced
Expand Down
19 changes: 15 additions & 4 deletions services/importer/lib/importer/downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,25 @@ def raise_if_over_storage_quota(headers, available_quota_in_bytes=nil)
content_length_from(headers) > available_quota_in_bytes.to_i
end

def typhoeus_options
{
cookiefile: cookiejar,
cookiejar: cookiejar,
followlocation: true
}
end

def headers
@headers ||=
Typhoeus.head(translate(url), followlocation: true).headers
@headers ||= Typhoeus.head(translate(url), typhoeus_options).headers
end

def cookiejar
repository.fullpath_for("#{seed}_cookiejar")
end

def download
Typhoeus.get(translate(url), followlocation: true)
end
Typhoeus.get(translate(url), typhoeus_options)
end

def name_from(headers, url)
name_from_http(headers) || name_in(url)
Expand Down
4 changes: 2 additions & 2 deletions services/importer/lib/importer/url_translator/google_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class GoogleDocs

def translate(url)
return url if !supported?(url) || translated?(url)
return url.gsub(%r{#gid=\d+}, '')
.gsub(%r{spreadsheet/ccc}, 'spreadsheet/pub') + "&output=csv"
return url.gsub(%r{#gid=\d+}, '') + "&output=csv"
# .gsub(%r{spreadsheet/ccc}, 'spreadsheet/pub')
end #translate

def supported?(url)
Expand Down

0 comments on commit bbfed80

Please sign in to comment.