Skip to content

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

Closed

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

Activity

  1. added a commit that references this issue on Apr 18, 2026
    41d1ea7
  2. kuishou68 commented on Apr 18, 2026

    @kuishou68
    ContributorAuthor

    I've opened PR #1899 to fix this issue.

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

  3. added a commit that references this issue on Apr 20, 2026
    c53deaf
  4. added a commit that references this issue on Apr 20, 2026
    e3a5f6b
  5. added a commit that references this issue on Apr 20, 2026
    3a24d71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions