rails-assets-manifest 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4486b5a02b2aea1cfdcc7afbd89a0748b6f746476175335a9af1d22afb0d4ffa
4
- data.tar.gz: e2007d8ac77c1183d5d5f598b1b6442ec09abe36b139c93c5a693330ffc41001
3
+ metadata.gz: f74ada8a7abade960a8bbb990ef4bcf5b9f042e09024d1de5b39cbf1a2ccf1ec
4
+ data.tar.gz: d45b22c32fe3981382d47c9680e3102e48c2d30211c24a1eac1e7baab8cd24a6
5
5
  SHA512:
6
- metadata.gz: db93bb819d42cbb4771404d560d50c37c4cd97fe4cfabdf764a5b0efc49ccfc0bf6a1f644bc46204a4cabfb2bdbf6d77ddf100105a0231f796f41f0b940b1bf2
7
- data.tar.gz: be4ebdfe6625038294029a2bf2916dff4488184716a69fcb8e7f18fc4db9375953ab501bdea59f933b4d6e1ca3357235b71544b4a236ebe239956a4ec07793f6
6
+ metadata.gz: d993c84c80510ab83df09c15838c8a07fc909d8d90b7891f340fb7501319bbac75d934d8f5fbfc52864d62ed47c560da9bbd93687b2d9dc5ce3d8d6abac94ec1
7
+ data.tar.gz: a6543487813204d1061a4db57edaaa3fe721c90b51f71ca787d2d858873719491a71e159ffa1618cb2edd5e579e77eefeb16771aff81313cdec9d66e2f36c421
data/CHANGELOG.md CHANGED
@@ -17,6 +17,13 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
17
17
  ### Breaks
18
18
 
19
19
 
20
+ ## 2.1.2 - (2021-09-05)
21
+ ---
22
+
23
+ ### Fixes
24
+ * Return correct fully qualified URLs from manifest when relative URL host or asset host is configured
25
+
26
+
20
27
  ## 2.1.1 - (2021-06-20)
21
28
  ---
22
29
 
@@ -2,6 +2,26 @@
2
2
 
3
3
  module Rails::Assets::Manifest
4
4
  module Helper
5
+ URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}i.freeze
6
+
7
+ def path_to_asset(source, options)
8
+ if (entry = ::Rails::Assets::Manifest.lookup(path_with_extname(source, options)))
9
+ # Directly return the entry src if it is a fully qualified URL. Otherwise,
10
+ # Rails will join the URL with `relative_url_root` and/or asset host.
11
+ return entry.src if URI_REGEXP.match?(entry.src)
12
+
13
+ if entry.src[0] == '/'
14
+ # When the asset name starts with a slash, Rails will skip an
15
+ # additional lookup via `#compute_asset_path` and directly use the
16
+ # provided path. As we already have looked up the manifest entry here,
17
+ # we can pass the entry source, but only *if* it starts with a slash.
18
+ return super entry.src, options
19
+ end
20
+ end
21
+
22
+ super
23
+ end
24
+
5
25
  def compute_asset_path(name, _options)
6
26
  ::Rails::Assets::Manifest.lookup!(name).src
7
27
  rescue EntryMissing
@@ -5,7 +5,7 @@ module Rails
5
5
  module Manifest
6
6
  class Railtie < ::Rails::Railtie
7
7
  # If this plugin is used with sprockets this option
8
- # already exists and must not be overriden. Otherwise
8
+ # already exists and must not be overridden. Otherwise
9
9
  # all sprockets default options are removed breaking
10
10
  # sprockets.
11
11
  config.assets = ::ActiveSupport::OrderedOptions.new unless config.respond_to?(:assets)
@@ -20,7 +20,7 @@ module Rails
20
20
 
21
21
  config.after_initialize do |_|
22
22
  ActiveSupport.on_load(:action_view) do
23
- include Helper
23
+ prepend Helper
24
24
  end
25
25
  end
26
26
 
@@ -6,7 +6,7 @@ module Rails
6
6
  module VERSION
7
7
  MAJOR = 2
8
8
  MINOR = 1
9
- PATCH = 1
9
+ PATCH = 2
10
10
  STAGE = nil
11
11
 
12
12
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-assets-manifest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-20 00:00:00.000000000 Z
11
+ date: 2021-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubygems_version: 3.2.15
107
+ rubygems_version: 3.2.22
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Load all rails assets from an external manifest.