Don't lookup resource for path if the path is absolute. Fixes #1195

This commit is contained in:
Thomas Reynolds 2015-03-03 13:09:46 -08:00
parent a71589becd
commit 7f2048b865
2 changed files with 20 additions and 2 deletions

View file

@ -169,14 +169,14 @@ module Middleman
if path_or_resource.is_a?(::Middleman::Sitemap::Resource)
resource = path_or_resource
resource_url = url
elsif this_resource && uri.path
elsif this_resource && uri.path && !uri.host
# Handle relative urls
url_path = Pathname(uri.path)
current_source_dir = Pathname('/' + this_resource.path).dirname
url_path = current_source_dir.join(url_path) if url_path.relative?
resource = app.sitemap.find_resource_by_path(url_path.to_s)
resource_url = resource.url if resource
elsif options[:find_resource] && uri.path
elsif options[:find_resource] && uri.path && !uri.host
resource = app.sitemap.find_resource_by_path(uri.path)
resource_url = resource.url if resource
end