-
Notifications
You must be signed in to change notification settings - Fork 346
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
Fix get_non_fingerprinted with dashed filenames #414
Conversation
upload_files uses get_non_fingerprinted to determine if any non-fingerprinted files need to be uploaded because there's a new fingerprinted files. It does this by determining that if assets/image-digest.png needs to be uploaded then assets/image.png should also be uploaded, if it exists. But it faultily would determine that if assets/great-image-digest.png needed to be uploaded then assets/great.png should be uploaded if it exists instead of assets/great-image.png
Will try to review this week |
lib/asset_sync/storage.rb
Outdated
@@ -4,7 +4,7 @@ | |||
|
|||
module AssetSync | |||
class Storage | |||
REGEXP_FINGERPRINTED_FILES = /^(.*)\/([^-]+)-[^\.]+\.([^\.]+)$/ | |||
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason you changed the anchors as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original anchors only anchored per line and not the whole string. While rare, it is possible to have file names with new lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add a test case for file name with new line then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. I originally left it out since it's such an extreme edge case, though it did flush out another issue.
Released in |
upload_files
usesget_non_fingerprinted
to determine if any non-fingerprinted files need to be uploaded because there's a new fingerprinted file. It does this by determining that ifassets/image-digest.png
needs to be uploaded thenassets/image.png
should also be uploaded, if it exists. But it faultily would determine that ifassets/great-image-digest.png
needed to be uploaded thenassets/great.png
should be uploaded if it exists instead ofassets/great-image.png
.