Fix 404 for sub-mounted apps
404 now shows full path (similar to url).
This commit is contained in:
parent
46ebc9d518
commit
7bec48c688
|
@ -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