diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 6dabe0e8126d6871f03acc82ce0db8557f9ee58a..c173d421a4dbdc00a23cf188e61b67f6a9b1cecd 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -193,6 +193,12 @@ setup_deploy() {
 # $2: Path on the server to upload to (e.g. private-upload/wheels/gitlab/)
 dav_upload() {
   log_info "curl: ${1} -> ${DOCSERVER}/${2}..."
+
+  if [ ! -e $1 ]; then
+    log_error "File \`${1}\' does not exist on the local disk"
+    exit 1
+  fi
+
   local code=`curl --location --silent --fail --write-out "%{http_code}" --user "${DOCUSER}:${DOCPASS}" --upload-file ${1} ${DOCSERVER}/${2}`
   if [[ ${code} == *204 || ${code} == *201 ]]; then
     log_info "Successfully uploaded ${1} with curl"
@@ -252,6 +258,11 @@ dav_delete() {
 dav_upload_folder() {
   log_info "curl: ${1} -> ${DOCSERVER}/${2}..."
 
+  if [ ! -e $1 ]; then
+    log_error "Directory \`${1}\' does not exist on the local disk"
+    exit 1
+  fi
+
   find "$1" | while read -r fname; do
     # make sure the location has at least 1 '/' at the end
     # more than 1 '/' together (e.g. '//') is interpreted as 1 '/'