Skip to content

Bug: WebP image MIME type check uses 'webp' instead of 'image/webp' in handleResponse #1898

@kuishou68

Description

@kuishou68

Bug Report

File: src/daemon/client.ts

Description

In the handleResponse function, the MIME type case for WebP images is incorrectly written as 'webp' instead of 'image/webp'. This means WebP images served with the correct MIME type (image/webp) will never match the case, fall through to the default .png extension, and be saved with the wrong extension.

Affected Code (lines ~145-149)

switch (mimeType) {
  case 'image/jpg':
  case 'image/jpeg':
    extension = '.jpeg';
    break;
  case 'webp':          // ❌ Should be 'image/webp'
    extension = '.webp';
    break;
}

Expected Behavior

WebP images should be saved with the .webp extension.

Actual Behavior

WebP images are saved with the default .png extension because 'webp' never matches the mimeType string 'image/webp'.

Fix

Change case 'webp': to case 'image/webp':

Signed-off-by: cocoon 54054995+kuishou68@users.noreply.github.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions