extensions icon indicating copy to clipboard operation
extensions copied to clipboard

[storage-resize-images] converting other formats into TIFF.

Open posiek07 opened this issue 5 years ago • 2 comments

[READ] Step 1: Are you in the right place?

Yes.

[REQUIRED] Step 2: Describe your configuration

  • Extension name: storage-resize-images
  • Extension version: 0.1.24
  • Configuration values: Screenshot 2021-11-26 at 10 11 10

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

  1. Use my configuration of extension.
  2. Upload files in jpg, webp or png format.
  3. Try to download the converted TIFF file thru Cloud Storage link in Firebase Console.

When trying to download converted images from jpg, png, webp to TIFF in the live version of the extension I am actually downloading files in their source file format.

I have tried to debug it as well with the Firebase Emulator. The problem is NOT occurring when I am debugging it locally. Everything works as expected so I can download converted TIFF. Screenshot 2021-12-07 at 14 38 23

Expected result

When the file (jpg,png,webp) is converted to TIFF you should be able to download this TIFF thru Firebase Storage link in Live Console.

Actual result

When trying to download the converted TIFF file in a live version of Firebase Console in Cloud Storage I am receiving a resized file in its original file format (jpg,png,webp) and filename. Screenshot 2021-11-26 at 10 01 36

posiek07 avatar Nov 26 '21 10:11 posiek07

if this works in the emulator potentially its not a Sharp library issue

i14h avatar Dec 21 '21 17:12 i14h

This issue occurs as the underlying metaData in Firebase storage is not currently updated when resizing the file.

   // filename\*=utf-8''  selects any string match the filename notation.
    // [^;\s]+ searches any following string until either a space or semi-colon.
    const contentDisposition = objectMetadata.contentDisposition.replace(
      /(filename\*=utf-8''[^;\s]+)/,
      `filename*=utf-8''${modifiedFileName}`
    );

    // Cloud Storage files.
    const metadata: { [key: string]: any } = {
      contentDisposition,
      contentEncoding: objectMetadata.contentEncoding,
      contentLanguage: objectMetadata.contentLanguage,
      contentType: imageContentType,
      metadata: objectMetadata.metadata || {},
    };

dackers86 avatar Jan 04 '22 17:01 dackers86