Merge pull request #1434 from joost/patch-1
Fix 404 for sub-mounted apps
This commit is contained in:
commit
b666a7aaee
|
@ -82,6 +82,7 @@ module Middleman
|
||||||
request_path.force_encoding('UTF-8')
|
request_path.force_encoding('UTF-8')
|
||||||
end
|
end
|
||||||
request_path = ::Middleman::Util.full_path(request_path, @middleman)
|
request_path = ::Middleman::Util.full_path(request_path, @middleman)
|
||||||
|
full_request_path = File.join(env['SCRIPT_NAME'], request_path) # Path including rack mount
|
||||||
|
|
||||||
# Run before callbacks
|
# Run before callbacks
|
||||||
@middleman.run_hook :before
|
@middleman.run_hook :before
|
||||||
|
@ -90,7 +91,7 @@ module Middleman
|
||||||
resource = @middleman.sitemap.find_resource_by_destination_path(request_path.gsub(' ', '%20'))
|
resource = @middleman.sitemap.find_resource_by_destination_path(request_path.gsub(' ', '%20'))
|
||||||
|
|
||||||
# Return 404 if not in sitemap
|
# Return 404 if not in sitemap
|
||||||
return not_found(res, request_path) unless resource && !resource.ignored?
|
return not_found(res, full_request_path) unless resource && !resource.ignored?
|
||||||
|
|
||||||
# If this path is a binary file, send it immediately
|
# If this path is a binary file, send it immediately
|
||||||
return send_file(resource, env) if resource.binary?
|
return send_file(resource, env) if resource.binary?
|
||||||
|
|
Loading…
Reference in a new issue