Skip to content

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

Open
florentdupont wants to merge 1 commit into
RiotGamesCookbooks:masterfrom
florentdupont:multiextensions_extract
Open

Multi-period (tar.gz) file extensions fix for extract_artifact!#156
florentdupont wants to merge 1 commit into
RiotGamesCookbooks:masterfrom
florentdupont:multiextensions_extract

Conversation

@florentdupont
Copy link
Copy Markdown
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
Copy Markdown

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

@colin-harms
Copy link
Copy Markdown

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