scripts: be more specific with file extension for tar files in preview script
This commit is contained in:
parent
ee3f623095
commit
43dca23e90
|
@ -70,7 +70,7 @@ if [[ $mimetype == inode/directory ]]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
if [[ $filename == *.djvu ]] || [[ $mimetype == @(image/vnd.djvu*|image/x-djvu) ]]; then
|
||||
if [[ $mimetype == @(image/vnd.djvu?(+multipage)|image/x-djvu) ]]; then
|
||||
djvutxt "$FILE" || exiftool "$FILE"
|
||||
exit
|
||||
fi
|
||||
|
@ -132,12 +132,12 @@ if [[ $mimetype == @(application/zip|application/zlib|application/java-archive|a
|
|||
exit
|
||||
fi
|
||||
|
||||
if [[ $filename == *.tar.zst ]] || [[ $mimetype == @(application/x-?(g)tar*|application/*-compressed-tar) ]]; then
|
||||
if [[ $filename == @(*.tar.@(zst|gz|lz|lzma|lzo|xz|Z)|*.tb2|*.tz2|*.tbz|*.tbz2|*.taz|*.tgz|*.tlz|*.txz|*.tZ|*.taZ|*.tzst) ]] || [[ $mimetype == @(application/x-?(g)tar*|application/*-compressed-tar) ]]; then
|
||||
tar -tvf "$FILE" || bsdtar -tf "$FILE"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $mimetype == @(application/zstd) ]]; then
|
||||
if [[ $mimetype == application/zstd ]]; then
|
||||
zstd -l "$FILE"; exit
|
||||
fi
|
||||
|
||||
|
@ -181,7 +181,7 @@ if [[ $mimetype == application/x-ipynb+json ]]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
if [[ $mimetype == @(application/json*|application/*+json) ]]; then
|
||||
if [[ $mimetype == text/plain ]] && [[ $filename == *.json?(c|5) ]] || [[ $mimetype == @(application/json*|application/*+json) ]]; then
|
||||
gojq -C . "$FILE" || jaq --color=always . "$FILE" || bat --style=plain --color=always "$FILE" || python3 -m json.tool -- "$FILE"
|
||||
exit
|
||||
fi
|
||||
|
@ -191,7 +191,7 @@ if [[ $mimetype == text/plain ]] && [[ $filename == *.@(md|mkd|markdown) ]] || [
|
|||
fi
|
||||
|
||||
if [[ $mimetype == @(text/*|application/javascript|application/xhtml+xml) ]]; then
|
||||
bat --style plain --color=always "$FILE"; exit
|
||||
bat --style plain --color=always "$FILE"; exit
|
||||
fi
|
||||
|
||||
# Try to get something out of exiftool
|
||||
|
|
Loading…
Reference in New Issue