fix(cli): correct WebP MIME type check in handleResponse ('webp' → 'image/webp') (#1899)

## Summary

Fixes a bug in `src/daemon/client.ts` where the MIME type case for WebP
images was `'webp'` instead of the correct `'image/webp'`.

## Problem

In `handleResponse`, the switch statement for determining file extension
used the incorrect string `'webp'` as the MIME type. Since browsers and
servers send `image/webp` as the MIME type, the case never matched, and
all WebP images were saved with a `.png` extension instead of `.webp`.

```ts
// Before (buggy)
case 'webp':
  extension = '.webp';
  break;

// After (fixed)
case 'image/webp':
  extension = '.webp';
  break;
```

## Testing

WebP screenshots/images returned by the tool will now correctly receive
the `.webp` extension.

Closes #1898

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

Signed-off-by: cocoon <54054995+kuishou68@users.noreply.github.com>
This commit is contained in:
Cocoon-Break
2026-04-20 19:48:12 +08:00
committed by GitHub
parent 0f29acf7cc
commit e3a5f6bb69
+1 -1
View File
@@ -172,7 +172,7 @@ export async function handleResponse(
case 'image/jpeg':
extension = '.jpeg';
break;
case 'webp':
case 'image/webp':
extension = '.webp';
break;
}