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

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

Merged
OrKoN merged 1 commit intoChromeDevTools:mainfrom
kuishou68:fix/issue-1898-webp-mime-type
Apr 20, 2026
Merged

fix(cli): correct WebP MIME type check in handleResponse ('webp' → 'image/webp')#1899
OrKoN merged 1 commit intoChromeDevTools:mainfrom
kuishou68:fix/issue-1898-webp-mime-type

Conversation

@kuishou68
Copy link
Copy Markdown
Contributor

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.

// 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

Copy link
Copy Markdown
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@OrKoN OrKoN changed the title fix: correct WebP MIME type check in handleResponse ('webp' → 'image/webp') fix(cli): correct WebP MIME type check in handleResponse ('webp' → 'image/webp') Apr 20, 2026
@OrKoN OrKoN enabled auto-merge April 20, 2026 07:05
…onse (Closes ChromeDevTools#1898)

Signed-off-by: cocoon <54054995+kuishou68@users.noreply.github.com>
@OrKoN OrKoN force-pushed the fix/issue-1898-webp-mime-type branch from 41d1ea7 to c53deaf Compare April 20, 2026 11:40
@OrKoN OrKoN added this pull request to the merge queue Apr 20, 2026
Merged via the queue into ChromeDevTools:main with commit e3a5f6b Apr 20, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants