From 2d0f0de182bb4dcb43b83004a80c15336d6e8076 Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Thu, 8 Oct 2026 09:25:38 +0200 Subject: [PATCH] Immich: only mention the HEIC patch when it applies On 3.3.0 the sharp call it rewrites is gone, so every run printed "pattern not found, skipped" into the spinner line and then "Patched". Check for the pattern first and stay silent otherwise. --- ct/immich.sh | 21 ++++----------------- install/immich-install.sh | 21 ++++----------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/ct/immich.sh b/ct/immich.sh index 6754deb48..eec9e55c8 100644 --- a/ct/immich.sh +++ b/ct/immich.sh @@ -347,25 +347,12 @@ EOF fi # MickLesk temporary patch for HEIC thumbnail gen - msg_info "Patching media.repository.js" MEDIA_REPO_JS="/opt/immich/app/dist/repositories/media.repository.js" - if [[ -f "$MEDIA_REPO_JS" ]]; then - python3 - <<'PY' -from pathlib import Path -p = Path('/opt/immich/app/dist/repositories/media.repository.js') -s = p.read_text() -old = "(0, sharp_1.default)(input).metadata()" -new = "(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()" -if new in s: - print('hotfix already there') -elif old in s: - p.write_text(s.replace(old, new, 1)) - print('hotfix applied') -else: - print('pattern not found, skipped') -PY + if grep -qF "(0, sharp_1.default)(input).metadata()" "$MEDIA_REPO_JS" 2>/dev/null; then + msg_info "Patching media.repository.js" + sed -i '0,/(0, sharp_1\.default)(input)\.metadata()/s//(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()/' "$MEDIA_REPO_JS" + msg_ok "Patched media.repository.js" fi - msg_ok "Patched media.repository.js" # chown excluding upload dir contents (may be a mount with restricted permissions) chown immich:immich "$INSTALL_DIR" diff --git a/install/immich-install.sh b/install/immich-install.sh index 4093829a8..1ea0c6c65 100644 --- a/install/immich-install.sh +++ b/install/immich-install.sh @@ -490,25 +490,12 @@ ln -s "$GEO_DIR" "$APP_DIR" msg_ok "Installed GeoNames data" # MickLesk temporary patch for HEIC thumbnail gen -msg_info "Patching media.repository.js" MEDIA_REPO_JS="/opt/immich/app/dist/repositories/media.repository.js" -if [[ -f "$MEDIA_REPO_JS" ]]; then - python3 - <<'PY' -from pathlib import Path -p = Path('/opt/immich/app/dist/repositories/media.repository.js') -s = p.read_text() -old = "(0, sharp_1.default)(input).metadata()" -new = "(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()" -if new in s: - print('hotfix already there') -elif old in s: - p.write_text(s.replace(old, new, 1)) - print('hotfix applied') -else: - print('pattern not found, skipped') -PY +if grep -qF "(0, sharp_1.default)(input).metadata()" "$MEDIA_REPO_JS" 2>/dev/null; then + msg_info "Patching media.repository.js" + sed -i '0,/(0, sharp_1\.default)(input)\.metadata()/s//(0, sharp_1.default)(input, { unlimited: true, limitInputPixels: false }).metadata()/' "$MEDIA_REPO_JS" + msg_ok "Patched media.repository.js" fi -msg_ok "Patched media.repository.js" mkdir -p /var/log/immich touch /var/log/immich/{web.log,ml.log}