Open
Description
CONFIGURATION
- Extension name: _ (
storage-resize-images
) - Extension version: _ 0.2.6
- Configuration values (redact info where appropriate):
- _ Location: europe-west9
- _ Image sizes: 200x200,512x512,1280x960,1920x1080
- _ Image types to generate: image/webp
- _ Cloud Storage bucket for images: (default)
- _ Paths of images to resize: (blank)
- _ Path to store resized images: thumbnails
- _ Delete the original file: No
- _ Cache-Control header for resized images: days=365
Problem description:
I'm experiencing an issue where SVG files uploaded to Firebase Storage have "+xml" appended to their filenames, resulting in filenames like "icon.svg+xml". This happens even though the Content-Type is correctly set to image/svg+xml.
Steps to reproduce:
- Install and configure the storage-resize-images extension.
- Upload an SVG file (e.g., icon.svg) to a location in Firebase Storage where my security rules are configured to allow it. I am using my custom uploadImage function in my React application to do this.
- Observe that the uploaded file is named blason.svg+xml in the Storage bucket.
The uploaded SVG file should be named icon.svg in the Storage bucket.
The uploaded SVG file is named icon.svg+xml in the Storage bucket.
Additional Information:
- I have verified that the Content-Type is set to image/svg+xml during the upload.
- I have a custom security rule to validate SVG uploads:
function isValidSvg() {
return request.resource.contentType == 'image/svg+xml' &&
request.resource.name.matches('^.*\\.svg$') &&
request.resource.size < 1 * 1024 * 1024;
}
- I have a custom function to upload image on my client that force the contentType to 'image/svg+xml'.
- I am using the image/webp format for resized images.
- This issue seems specific to SVG files. Other image types are uploaded with the correct filenames.
Questions:
- Is this a known issue with Firebase Storage or the storage-resize-images extension when handling SVG files?
- Is there a recommended way to prevent Firebase Storage from appending "+xml" to SVG filenames, besides the workaround of using a Cloud Function to rename the files after upload?
- Could there be a conflict between my custom security rules and the extension's behavior, even though the extension documentation doesn't explicitly mention special handling for SVG files?
- My custom configuration for managing images is available in the file src/config/imageConfig.ts. Could it be relevant to this issue, and if so, what changes should I consider?
Thank you.