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

Multi-period (tar.gz) file extensions fix for extract_artifact! #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

florentdupont
Copy link
Contributor

Archives with multi-period extensions (like tar.gz for example) are not matched correctly by the extract_artifact! method.
The problem with the actual implementation is that ::File.extname() for a multi-period filename extension doesn't extract all the part but only the last unique extension after the last ..
For instance : foo.tar.gz gets an extension .gz instead of .tar.gz.

The use of an heuristic is necessary to guess the real extension. This heuristic is done inside the new extname() function.

For this correction, this function will return :

extname("test.rb")         #=> ".rb"
extname("a/b/d/test.rb")   #=> ".rb"
extname("foo.")            #=> ""
extname("test")            #=> ""
extname(".profile")        #=> ""
extname(".profile.sh")     #=> ".sh"
extname("myfile.tar.gz")   #=> ".tar.gz"
extname("my.file.tar.gz")  #=> ".tar.gz"
extname("tar.gz")          #=> ".gz"

@kainosnoema
Copy link

Amazing timing, I just hit this one as well. Looks like it was broken in 35eb0ab.

@colin-harms
Copy link

This is still an issue. As a result of this, the nexus-cookbook doesn't converge.
The nexus archive is: nexus-2.11.1-01-bundle.tar.gz

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