The id now should contain the relative path from the HELPER_DIR to
the image filename, including the image-type extension if needed.
IMAGE_NAME="${IMAGE_NAME:8}"
elif [[ "$IMAGE_NAME" =~ ^file:// ]]; then
IMAGE_NAME="${IMAGE_NAME:7}"
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
"will be removed in the future. Use local:// instead."
fi
report_error "Unable to retrieve image file."
fi
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
+ 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"
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"