From 3c55a912c8d188a40260761ddcc994e02672fb55 Mon Sep 17 00:00:00 2001 From: psychhim Date: Tue, 18 Nov 2025 14:04:20 +0530 Subject: [PATCH] Fix: delete flag couldn't work without -u flag --- upload.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/upload.sh b/upload.sh index c2c2a78..f13459e 100755 --- a/upload.sh +++ b/upload.sh @@ -193,8 +193,14 @@ if [[ -n "$DELETE_URL" ]]; then file_to_delete="$(basename "$DELETE_URL")" echo -e "${ORANGE}Deleting: $DELETE_URL${RESET}" >&2 - # Send POST request with "delete" field (assumes PHP server expects POST) - delete_response=$(curl -s -u "$USER_AUTH" -F "delete=$file_to_delete" "$UPLOAD_URL" || true) + if [[ "$UPLOAD_URL" =~ ^https?://([^/@]+)@ ]]; then + USER_AUTH="${BASH_REMATCH[1]}" + UPLOAD_URL_CLEAN="${UPLOAD_URL/\/\/$USER_AUTH@/\/\/}" + else + UPLOAD_URL_CLEAN="$UPLOAD_URL" + fi + + delete_response=$(curl -s -F "delete=$file_to_delete" "$UPLOAD_URL_CLEAN" ${USER_AUTH:+-u "$USER_AUTH"} || true) if [[ "$delete_response" == *"Deleted successfully"* ]]; then echo -e "${GREEN}Deleted successfully.${RESET}"