Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_non_fingerprinted with dashed filenames #414

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/asset_sync/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module AssetSync
class Storage
REGEXP_FINGERPRINTED_FILES = /^(.*)\/([^-]+)-[^\.]+\.([^\.]+)$/
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/m
REGEXP_ASSETS_TO_CACHE_CONTROL = /-[0-9a-fA-F]{32,}$/

class BucketNotFound < StandardError;
Expand Down
18 changes: 12 additions & 6 deletions spec/unit/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,22 @@

it 'should upload updated non-fingerprinted files' do
@local_files = [
'public/image.png',
'public/image-82389298328.png',
'public/image-a8389f9h324.png',
'public/great-image.png',
'public/great-image-82389298328.png',
'public/great-image-a8389f9h324.png',
"public/new\nline.js",
"public/new\nline-aaaaaaaaaaa.js",
"public/new\nline-bbbbbbbbbbb.js",
'public/application.js',
'public/application-b3389d983k1.js',
'public/application-ac387d53f31.js',
'public',
]
@remote_files = [
'public/image.png',
'public/image-a8389f9h324.png',
'public/great-image.png',
'public/great-image-a8389f9h324.png',
"public/new\nline.js",
"public/new\nline-aaaaaaaaaaa.js",
'public/application.js',
'public/application-b3389d983k1.js',
]
Expand All @@ -158,7 +163,8 @@
allow(File).to receive(:file?).and_return(true) # Pretend they all exist

updated_nonfingerprinted_files = [
'public/image.png',
'public/great-image.png',
"public/new\nline.js",
'public/application.js',
]
(@local_files - @remote_files + updated_nonfingerprinted_files).each do |file|
Expand Down