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

Conversation

cgriego
Copy link
Contributor

@cgriego cgriego commented Feb 15, 2021

upload_files uses get_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 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.

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
@coveralls
Copy link

coveralls commented Feb 15, 2021

Pull Request Test Coverage Report for Build 513

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 63.863%

Totals Coverage Status
Change from base Build 508: 0.0%
Covered Lines: 410
Relevant Lines: 642

💛 - Coveralls

@PikachuEXE
Copy link
Member

Will try to review this week
On vacation last week

@@ -4,7 +4,7 @@

module AssetSync
class Storage
REGEXP_FINGERPRINTED_FILES = /^(.*)\/([^-]+)-[^\.]+\.([^\.]+)$/
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/
Copy link
Member

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?

Ref for anchors

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@PikachuEXE PikachuEXE merged commit b01bb34 into AssetSync:master Mar 1, 2021
@PikachuEXE
Copy link
Member

Released in 2.13.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants