summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wang <firedfox@users.noreply.github.com>2023-09-03 23:08:19 +0800
committerGitHub <noreply@github.com>2023-09-03 17:08:19 +0200
commit1f56f2bdc455f2167c10fdbeca10934f5f0cbd99 (patch)
treeb7028df367af68d2a2888c57bbb518d04e7369e1
parent0dc40e88a3f5bbe2607d958b5f0bf79e9df0c118 (diff)
downloadzsh-1f56f2bdc455f2167c10fdbeca10934f5f0cbd99.tar.gz
zsh-1f56f2bdc455f2167c10fdbeca10934f5f0cbd99.tar.bz2
zsh-1f56f2bdc455f2167c10fdbeca10934f5f0cbd99.zip
fix(extract): remove extraction file extension for tar (#11873)
-rw-r--r--plugins/extract/extract.plugin.zsh5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh
index 513950f33..88d8b0740 100644
--- a/plugins/extract/extract.plugin.zsh
+++ b/plugins/extract/extract.plugin.zsh
@@ -30,6 +30,11 @@ EOF
local file="$1" full_path="${1:A}"
local extract_dir="${1:t:r}"
+ # Remove the .tar extension if the file name is .tar.*
+ if [[ $extract_dir =~ '\.tar$' ]]; then
+ extract_dir="${extract_dir:r}"
+ fi
+
# If there's a file or directory with the same name as the archive
# add a random string to the end of the extract directory
if [[ -e "$extract_dir" ]]; then