Fix asset_url and relative option bug.
If the relative option is set and the asset is stored in the directory alongside the resource referencing it, asset_url produces the wrong path ('../images/image.jpg' rather than just 'image.jpg').
This commit is contained in:
parent
563da9d45b
commit
0436c211c6
2 changed files with 19 additions and 1 deletions
|
@ -77,7 +77,11 @@ module Middleman
|
|||
uri = URI(path)
|
||||
path = uri.path
|
||||
|
||||
result = if resource = app.sitemap.find_resource_by_destination_path(url_for(app, path, options))
|
||||
# Ensure the url we pass into find_resource_by_destination_path is not a
|
||||
# relative path, since it only takes absolute url paths.
|
||||
dest_path = url_for(app, path, options.merge(relative: false))
|
||||
|
||||
result = if resource = app.sitemap.find_resource_by_destination_path(dest_path)
|
||||
resource.url
|
||||
else
|
||||
path = ::File.join(prefix, path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue