Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix extracting compressed downloaded files
This regressed in #2736. When we want to download a compressed file and extract it to produce the 'final' asset, we'll be doing something like downloading 'http://example.com/file.img.gz' to an asset called 'file.img'. After we download the asset, we write it to a temporary file and feed that temporary file into Archive::Extract, then extract it to the final asset location. Archive::Extract uses the filename of the input file to determine its type, so we should base the name of the temporary file on the path component of the URL (where the compression is indicated) - 'file.img.gz' in this case - and not on the final target filename (where the compression is not indicated) - 'file.img' in this case. Before #2736, that's what the code did, but in #2736 it was changed so the temporary filename is based on the target file. I guess it was hard for @kraih to work this out without a real- world example to understand how it's actually used in practice (I think only Fedora uses this feature). This returns the code to something similar to how it was before, but using `path()->to_string` as @kraih's version did. It also tweaks the test cases, which were clearly the wrong way round once you know how this is supposed to work (it doesn't make sense to expect extracting 'test.gz' to 'test.gz' to succeed, but extracting 'test.gz' to 'test' to fail). Signed-off-by: Adam Williamson <awilliam@redhat.com>
- Loading branch information