mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
Merge pull request #3673 from zdu-strong/v5-dev-compress-util
CompressUtil automatically decompress tgz and tar.gz files
This commit is contained in:
commit
1cb0ec327d
@ -171,6 +171,11 @@ public class CompressUtil {
|
||||
return new SevenZExtractor(file);
|
||||
}
|
||||
try {
|
||||
if (StrUtil.isBlank(archiverName) && file.getName().toLowerCase().endsWith(".tgz")) {
|
||||
archiverName = "tgz";
|
||||
} else if (StrUtil.isBlank(archiverName) && file.getName().toLowerCase().endsWith(".tar.gz")) {
|
||||
archiverName = "tar.gz";
|
||||
}
|
||||
return new StreamExtractor(charset, archiverName, file);
|
||||
} catch (CompressException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
|
Loading…
Reference in New Issue
Block a user