diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb index 80916a02..60538431 100644 --- a/middleman-cli/lib/middleman-cli/build.rb +++ b/middleman-cli/lib/middleman-cli/build.rb @@ -254,7 +254,7 @@ module Middleman::Cli FileUtils.cp(resource.source_file, output_file) else begin - response = @rack.get(URI.escape(resource.destination_path)) + response = @rack.get(URI.escape(resource.request_path)) if response.status == 200 base.create_file(output_file, binary_encode(response.body)) diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb index 18bc996e..b89ec083 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb @@ -49,12 +49,13 @@ module Middleman class EndpointResource < ::Middleman::Sitemap::Resource attr_accessor :output - def initialize(store, path, source_file) - @request_path = ::Middleman::Util.normalize_path(source_file) - + def initialize(store, path, request_path) super(store, path) + @request_path = ::Middleman::Util.normalize_path(request_path) end + attr_reader :request_path + def template? true end diff --git a/middleman-core/lib/middleman-core/sitemap/resource.rb b/middleman-core/lib/middleman-core/sitemap/resource.rb index 16ac10f0..62551ad5 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource.rb @@ -20,6 +20,11 @@ module Middleman # @return [String] attr_accessor :destination_path + # The path to use when requesting this resource. Normally it's + # the same as {#destination_path} but it can be overridden in subclasses. + # @return [String] + alias_method :request_path, :destination_path + # Set the on-disk source file for this resource # @return [String] def source_file