From f8d9c5ee705b1860a169784f2d538b8be64368f7 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Sat, 14 Mar 2026 11:35:11 +0100 Subject: [PATCH] fix(droplet): Use extension-based file detection for OpenWrt The 'file' command is not available on OpenWrt. Replaced mime-type detection with extension parsing (.html, .htm, .zip). Co-Authored-By: Claude Opus 4.5 --- .../secubox-app-droplet/files/usr/sbin/dropletctl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/package/secubox/secubox-app-droplet/files/usr/sbin/dropletctl b/package/secubox/secubox-app-droplet/files/usr/sbin/dropletctl index e39b6c65..121ca159 100644 --- a/package/secubox/secubox-app-droplet/files/usr/sbin/dropletctl +++ b/package/secubox/secubox-app-droplet/files/usr/sbin/dropletctl @@ -74,9 +74,10 @@ cmd_publish() { log_info "Publishing: $file as $vhost" - # Extract if ZIP - local content_type=$(file -b --mime-type "$file") - if echo "$content_type" | grep -q "zip"; then + # Detect file type by extension (file command not available on OpenWrt) + local file_ext=$(echo "$file" | sed 's/.*\.//' | tr '[:upper:]' '[:lower:]') + + if [ "$file_ext" = "zip" ]; then log_info "Extracting ZIP..." unzip -q "$file" -d "$tmp_dir" || { log_error "Failed to extract ZIP"; rm -rf "$tmp_dir"; return 1; } @@ -86,11 +87,11 @@ cmd_publish() { mv "$nested"/* "$tmp_dir/" 2>/dev/null rmdir "$nested" 2>/dev/null fi - elif echo "$content_type" | grep -qE "html|text"; then + elif [ "$file_ext" = "html" ] || [ "$file_ext" = "htm" ]; then # Single HTML file cp "$file" "$tmp_dir/index.html" else - log_error "Unsupported file type: $content_type" + log_error "Unsupported file type: .$file_ext (expected .html, .htm, or .zip)" rm -rf "$tmp_dir" return 1 fi