From 25ea0cc25883cdd453aaa1ff2d7c41ecd773da45 Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Thu, 29 May 2025 21:53:44 +0100 Subject: [PATCH] fix: add CSS file recovery mechanism for failed tarball extractions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced the CSS verification to actively recover the CSS file if it's missing, empty, or corrupted after tarball extraction. The script now attempts direct extraction of just the CSS file from the release tarball as a fallback mechanism. This ensures that even if the main tarball extraction has issues, users will still get a working CSS file and proper frontend styling. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- scripts/install-pulse.sh | 44 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/scripts/install-pulse.sh b/scripts/install-pulse.sh index d464f10c7..6879a3a07 100755 --- a/scripts/install-pulse.sh +++ b/scripts/install-pulse.sh @@ -456,36 +456,42 @@ perform_tarball_update() { print_info "NPM dependencies already present in tarball." fi - # Always check if CSS assets need building for tarball updates + # Always check if CSS assets are valid after tarball extraction print_info "Verifying CSS assets in $PULSE_DIR..." # Check if output.css exists and is valid (not corrupted with HTML content) - css_needs_fix=false if [ ! -f "$PULSE_DIR/src/public/output.css" ]; then - print_warning "output.css file is missing - will be restored from tarball" - css_needs_fix=true + print_error "Critical: output.css file is missing after tarball extraction. This indicates a problem with the tarball or extraction process." + # Try to re-extract just the CSS file as a fallback + if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$TARGET_TAG/pulse-${TARGET_TAG#v}.tar.gz" | tar -xzf - --to-stdout "pulse-${TARGET_TAG#v}/src/public/output.css" > "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + print_success "CSS file recovered using direct extraction." + else + print_error "Failed to recover CSS file. Frontend may not display correctly." + fi elif [ ! -s "$PULSE_DIR/src/public/output.css" ]; then - print_warning "output.css file is empty - will be restored from tarball" - css_needs_fix=true + print_error "Critical: output.css file is empty after tarball extraction." + # Try to re-extract just the CSS file as a fallback + if curl -sL "https://github.com/rcourtman/Pulse/releases/download/$TARGET_TAG/pulse-${TARGET_TAG#v}.tar.gz" | tar -xzf - --to-stdout "pulse-${TARGET_TAG#v}/src/public/output.css" > "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + print_success "CSS file recovered using direct extraction." + else + print_error "Failed to recover CSS file. Frontend may not display correctly." + fi elif head -1 "$PULSE_DIR/src/public/output.css" 2>/dev/null | grep -q "/dev/null | grep -q " "$PULSE_DIR/src/public/output.css" 2>/dev/null; then + # Verify the recovery worked + if [ -s "$PULSE_DIR/src/public/output.css" ] && ! head -1 "$PULSE_DIR/src/public/output.css" 2>/dev/null | grep -q "