Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage-resize-images] SVG files are uploaded with "+xml" appended to the extension #2243

Open
salvia34 opened this issue Dec 19, 2024 · 0 comments
Labels
type: bug Something isn't working

Comments

@salvia34
Copy link

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:

  1. Install and configure the storage-resize-images extension.
  2. 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.
  3. 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:
  1. Is this a known issue with Firebase Storage or the storage-resize-images extension when handling SVG files?
  2. 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?
  3. 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?
  4. 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.

@salvia34 salvia34 added the type: bug Something isn't working label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant