Skip to content

Fix Image Resizer context menu appearing for unsupported file types#45427

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-psd-context-menu-error
Draft

Fix Image Resizer context menu appearing for unsupported file types#45427
Copilot wants to merge 5 commits intomainfrom
copilot/fix-psd-context-menu-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Summary of the Pull Request

Image Resizer context menu appeared for PSD and other unsupported formats, failing with error on resize attempt. Fixed by adding extension whitelist validation before showing menu.

PR Checklist

  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: All end-user-facing strings can be localized
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Root cause: Context menu handlers relied on AssocGetPerceivedType() which returns PERCEIVED_TYPE_IMAGE for any Windows-registered image type (e.g., PSD via Photoshop). Image Resizer only processes WIC-compatible formats.

Changes:

  • Added SupportedImageExtensions whitelist and validation function to ImageResizerConstants.h
  • Updated both MSI (ContextMenuHandler.cpp) and MSIX (dllmain.cpp) handlers to validate extensions in QueryContextMenu() and GetState()
  • Context menu now hidden for unsupported types regardless of Windows perceived type

Implementation:

// ImageResizerConstants.h
inline const std::vector<std::wstring> SupportedImageExtensions = {
    L".bmp", L".dib", L".gif", L".jfif", L".jpe", L".jpeg", L".jpg", 
    L".jxr", L".png", L".rle", L".tif", L".tiff", L".wdp"
};

inline bool IsSupportedImageExtension(LPCWSTR extension) { /* ... */ }

Single source of truth eliminates duplication between MSI/MSIX implementations.

Validation Steps Performed

Manual testing required:

  • Verify PSD files no longer show Image Resizer context menu
  • Verify supported formats (JPG, PNG, BMP, etc.) continue to show menu and resize correctly
  • Test both regular right-click and drag-drop contexts
Original prompt

This section details on the original issue you should resolve

<issue_title>Resize in Right Click Drag context menu for PSD files</issue_title>
<issue_description>### Microsoft PowerToys version

0.71.0

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

Image Resizer

Steps to reproduce

Right-click drag any PSD file and you get "Resize Pictures Here" context menu, and when proceeding to resize it shows error "Can't resize the following pictures"

✔️ Expected Behavior

It shouldn't show the resize context menu as for all other non image files

❌ Actual Behavior

It shows resize here context menu

Other Software

No response</issue_description>

<agent_instructions>Implement a proper fix for this issue. Do NOT create placeholder stub files. Create actual working code that addresses the issue described. Follow PowerToys coding guidelines and conventions.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@cinnamon-msft Are you still experiencing this issue? /needinfo

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 5, 2026 15:20
…ike PSD

- Add extension whitelist check in both MSI and MSIX context menu handlers
- Validate file extensions against supported list before showing menu
- Prevents context menu from appearing for .psd and other unsupported formats

Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
- Move extension list and validation function to ImageResizerConstants.h
- Eliminate code duplication between MSI and MSIX handlers
- Single source of truth for supported extensions

Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
- Use modern convention (extension == nullptr) for better readability
- Add clarifying comment about lowercase requirement in extension list

Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
Security analysis completed - whitelist approach with proper input validation

Co-authored-by: yeelam-gordon <73506701+yeelam-gordon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix resize context menu for PSD files Fix Image Resizer context menu appearing for unsupported file types Feb 5, 2026
Copilot AI requested a review from yeelam-gordon February 5, 2026 15:25
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.

Resize in Right Click Drag context menu for PSD files

2 participants