diff options
Diffstat (limited to '')
-rw-r--r-- | plugins/gist_tag.rb | 6 | ||||
-rw-r--r-- | plugins/octopress_filters.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/plugins/gist_tag.rb b/plugins/gist_tag.rb index 9bdd14dc..61a9cc1e 100644 --- a/plugins/gist_tag.rb +++ b/plugins/gist_tag.rb @@ -78,8 +78,11 @@ module Jekyll gist_url = get_gist_url_for(gist, file) data = get_web_content(gist_url) - if data.code.to_i == 302 + locations = Array.new + while (data.code.to_i == 301 || data.code.to_i == 302) data = handle_gist_redirecting(data) + break if locations.include? data.header['Location'] + locations << data.header['Location'] end if data.code.to_i != 200 @@ -95,6 +98,7 @@ module Jekyll if redirected_url.nil? || redirected_url.empty? raise ArgumentError, "GitHub replied with a 302 but didn't provide a location in the response headers." end + get_web_content(redirected_url) end diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb index 091f75aa..a2ed71f8 100644 --- a/plugins/octopress_filters.rb +++ b/plugins/octopress_filters.rb @@ -78,7 +78,7 @@ module OctopressLiquidFilters # Replaces relative urls with full urls def expand_urls(input, url='') url ||= '/' - input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]*)/ do + input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\/>]{1}[^\"'>]*)/ do $1+url+$3 end end |