File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -45,11 +45,6 @@ if [[ -z ${downloadUrl} ]]; then
4545 exit 1
4646fi
4747
48- if ! curl --head --fail ${downloadUrl} > /dev/null 2>&1 ; then
49- echo " download: Error: Invalid URL: ${downloadUrl} "
50- exit 1
51- fi
52-
5348if [[ -z ${filename} ]]; then
5449 filename=$( basename -- " ${downloadUrl} " )
5550fi
6560if [ ! -f " ${SHARED_DOWNLOADS_DIRECTORY} /${filename} " ] ; then
6661 echo " download: Downloading ${filename} from ${downloadUrl} into ${SHARED_DOWNLOADS_DIRECTORY} "
6762
63+ # Check if the URL is valid
64+ # The check is deferred and not done in the input validation block at the beginning.
65+ # This is because the check needs a network connection which shouldn't be required when the file had already been downloaded.
66+ if ! curl --head --fail ${downloadUrl} > /dev/null 2>&1 ; then
67+ echo " download: Error: Invalid URL: ${downloadUrl} "
68+ exit 1
69+ fi
70+
6871 # Download the file
6972 if ! curl -L --fail-with-body -o " ${SHARED_DOWNLOADS_DIRECTORY} /${filename} " " ${downloadUrl} " ; then
7073 echo " download: Error: Failed to download ${filename} "
You can’t perform that action at this time.
0 commit comments