From 7bec48c6886cafeac65b093ab7434fd84cfdf980 Mon Sep 17 00:00:00 2001 From: Joost Hietbrink Date: Mon, 26 Jan 2015 14:33:22 +0100 Subject: [PATCH] Fix 404 for sub-mounted apps 404 now shows full path (similar to url). --- middleman-core/lib/middleman-core/rack.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/rack.rb b/middleman-core/lib/middleman-core/rack.rb index 6e855ac2..9cc79212 100644 --- a/middleman-core/lib/middleman-core/rack.rb +++ b/middleman-core/lib/middleman-core/rack.rb @@ -82,6 +82,7 @@ module Middleman request_path.force_encoding('UTF-8') end 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 @middleman.run_hook :before @@ -90,7 +91,7 @@ module Middleman resource = @middleman.sitemap.find_resource_by_destination_path(request_path.gsub(' ', '%20')) # 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 return send_file(resource, env) if resource.binary?