Commit 9cd69cad authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Change the local back-end id format

The id now should contain the relative path from the HELPER_DIR to
the image filename, including the image-type extension if needed.
parent e88a9e49
......@@ -60,7 +60,7 @@ case $BACKEND_TYPE in
IMAGE_NAME="${IMAGE_NAME:8}"
elif [[ "$IMAGE_NAME" =~ ^file:// ]]; then
IMAGE_NAME="${IMAGE_NAME:7}"
log_warning "The file:// back-end identifier is deprecated and " \
log_warning "The file:// back-end identifier is deprecated and" \
"will be removed in the future. Use local:// instead."
fi
......@@ -70,15 +70,22 @@ case $BACKEND_TYPE in
report_error "Unable to retrieve image file."
fi
image_file="$IMAGE_DIR/$IMAGE_NAME.$IMAGE_TYPE"
canonical_image_file="$(canonicalize "$image_file")"
if [ ! -e "$canonical_image_file" ]; then
log_error "Image file \`$image_file' does not exist."
report_error "Unable to retrieve image file."
exit 1
image_file="$IMAGE_DIR/$IMAGE_NAME"
if [ ! -e "$image_file" ]; then
if [ -e "$image_file.$IMAGE_TYPE" ] ; then
image_file="$image_file.$IMAGE_TYPE"
log_warning "The \`.$IMAGE_TYPE' extension is missing from" \
"the local back-end id. This id form is deprecated and" \
" will be remove in the future."
else
log_error "Image file \`$image_file' does not exist."
report_error "Unable to retrieve image file."
exit 1
fi
fi
canonical_image_file="$(canonicalize "$image_file")"
if [[ "$canonical_image_file" != "$canonical_image_dir"* ]]; then
log_error "Image ID points to a file outside the image directory: \`$IMAGE_DIR'"
report_error "Invalid image ID"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment