From 3eba4d1c83e67cc9524a23d6f773a0556face6df Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 8 Jul 2025 08:56:26 +0200 Subject: [PATCH] filename --- install/stirling-pdf-install.sh | 4 ++-- misc/tools.func | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/install/stirling-pdf-install.sh b/install/stirling-pdf-install.sh index 093c9961..e89634f2 100644 --- a/install/stirling-pdf-install.sh +++ b/install/stirling-pdf-install.sh @@ -35,11 +35,11 @@ JAVA_VERSION="21" setup_java read -r -p "Do you want to Stirling-PDF with Login (Default = without Login)? [Y/n] " response response=${response,,} # Convert to lowercase if [[ "$response" == "y" || "$response" == "yes" || -z "$response" ]]; then - fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF-with-login.jar" + USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF-with-login.jar" mv Stirling-PDF-with-login.jar /opt/Stirling-PDF/Stirling-PDF.jar touch ~/.Stirling-PDF-login else - fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF.jar" + USE_ORIGINAL_FILENAME=true fetch_and_deploy_gh_release "stirling-pdf" "Stirling-Tools/Stirling-PDF" "singlefile" "latest" "/opt/Stirling-PDF" "Stirling-PDF.jar" fi msg_info "Installing LibreOffice Components" diff --git a/misc/tools.func b/misc/tools.func index c354cff7..eb335a79 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -925,7 +925,7 @@ function fetch_and_deploy_gh_release() { } mkdir -p "$target" - if [[ "$filename" == *.zip ]]; then + if [[ "$filename" == *.zip ]]; then if ! command -v unzip &>/dev/null; then $STD apt-get install -y unzip fi @@ -986,7 +986,12 @@ function fetch_and_deploy_gh_release() { filename="${asset_url##*/}" mkdir -p "$target" - curl $download_timeout -fsSL -o "$target/$app" "$asset_url" || { + + local use_filename="${USE_ORIGINAL_FILENAME:-false}" + local target_file="$app" + [[ "$use_filename" == "true" ]] && target_file="$filename" + + curl $download_timeout -fsSL -o "$target/$target_file" "$asset_url" || { msg_error "Download failed: $asset_url" rm -rf "$tmpdir" return 1