error handling for multiple file input

This commit is contained in:
Felix Lohmeier 2022-04-20 09:45:32 +02:00 committed by GitHub
parent 3bca2e429c
commit 3e6fb6a1d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,9 @@ function init_import() {
# create a zip archive if there are multiple files # create a zip archive if there are multiple files
if [[ ${#files[@]} -gt 1 ]]; then if [[ ${#files[@]} -gt 1 ]]; then
file="$tmpdir/Untitled.zip" file="$tmpdir/Untitled.zip"
zip "$file" "${files[@]}" if ! zip --quiet --must-match "$file" "${files[@]}"; then
error "creating zip archive with ${files[*]} failed!"
fi
else else
file="${files[0]}" file="${files[0]}"
fi fi