豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit e3a5f6b

Browse files
authored
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>
1 parent 0f29acf commit e3a5f6b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/daemon/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export async function handleResponse(
172172
case 'image/jpeg':
173173
extension = '.jpeg';
174174
break;
175-
case 'webp':
175+
case 'image/webp':
176176
extension = '.webp';
177177
break;
178178
}

0 commit comments

Comments
 (0)