From 39bcc52c1bf6a0efbbd4c900051feef9510670e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Van=C4=8Dura?= Date: Wed, 5 Feb 2025 10:53:56 +0100 Subject: [PATCH] Actor: Adding input document URL validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Vančura --- .actor/actor.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.actor/actor.sh b/.actor/actor.sh index 6faa34f5..1ec97ffd 100755 --- a/.actor/actor.sh +++ b/.actor/actor.sh @@ -58,6 +58,14 @@ case "$OUTPUT_FORMAT" in md | json | html | text | doctags) ;; ;; esac +# Validate URL is accessible. +echo "Validating document URL..." +if ! curl --output /dev/null --silent --head --fail "${DOCUMENT_URL}"; then + echo "Error: Unable to access document at URL: ${DOCUMENT_URL}" + echo "Please ensure the URL is valid and publicly accessible." + exit 1 +fi + # --- Build Docling command --- DOC_CONVERT_CMD="docling --verbose \"${DOCUMENT_URL}\" --to \"${OUTPUT_FORMAT}\""