Skip to content

localStorageProvider always writes .png regardless of image MIME type #119

@mayashavin

Description

@mayashavin

Problem

src/providers/storage/localStorageProvider.ts (lines 20–23) always appends .png to the output filename:

const filePath = path.join(outputDir, `${normalizedFileName}.png`);
const publicUrl = `${publicPathPrefix}/${normalizedFileName}.png`;

The GeneratedImage type has a mimeType field. If a future image provider returns image/jpeg or image/webp, the file would be saved with the wrong extension, corrupting the file type association.

Expected behavior

Derive the extension from image.mimeType:

image/png → .png
image/jpeg → .jpg
image/webp → .webp

Fall back to .png if the MIME type is unknown.

Files affected

src/providers/storage/localStorageProvider.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions