diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index ded832cb47b..c1e18eed909 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -206,7 +206,7 @@ class StaticController < ApplicationController content = Rails.application.assets_manifest.find_sources('service-worker.js').first content = content.sub( /^\/\/# sourceMappingURL=(service-worker-.+\.map)$/ - ) { "//# sourceMappingURL=#{helpers.script_asset_path(Regexp.last_match(1))}" } + ) { "//# sourceMappingURL=#{helpers.script_asset_path('service-worker')}.map" } render( plain: content, content_type: 'application/javascript' diff --git a/spec/requests/static_controller_spec.rb b/spec/requests/static_controller_spec.rb index 4f0a926626a..cbebd9f35fa 100644 --- a/spec/requests/static_controller_spec.rb +++ b/spec/requests/static_controller_spec.rb @@ -420,7 +420,7 @@ describe StaticController do get "/service-worker.js" expect(response.status).to eq(200) expect(response.content_type).to start_with("application/javascript") - expect(response.body).to include("sourceMappingURL=/assets/service-worker-abcde.js.map") + expect(response.body).to include("sourceMappingURL=/assets/service-worker.js.map\n") end end end