-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add support for .cgm (Computer Graphics Metafile) extension to MediaTypeMap #122591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Added .cgm to s_extensionToMediaType dictionary mapped to image/cgm - Added image/cgm to s_mediaTypeToExtension dictionary mapped to .cgm - Updated ExtensionToMediaTypeCount from 403 to 404 - Updated MediaTypeToExtensionCount from 294 to 295 - Added test cases for .cgm extension in MediaTypeMapTest - All tests passed successfully Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for the .cgm (Computer Graphics Metafile) file extension to the MediaTypeMap class, enabling proper MIME type resolution for this IANA-registered format (ISO 8632 standard) commonly used in technical documentation, engineering, and aviation industries.
Key Changes:
- Added bidirectional mapping between
.cgmextension andimage/cgmMIME type inMediaTypeMap.cs - Updated dictionary size constants to reflect the addition (
ExtensionToMediaTypeCount: 403→404,MediaTypeToExtensionCount: 294→295) - Added comprehensive test coverage for both mapping directions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/libraries/System.Net.Mail/src/System/Net/Mime/MediaTypeMap.cs |
Added .cgm → image/cgm mapping in s_extensionToMediaType dictionary (line 65), added image/cgm → .cgm mapping in s_mediaTypeToExtension dictionary (line 633), and updated both dictionary count constants (lines 16-17) |
src/libraries/System.Net.Mail/tests/Functional/MediaTypeMapTest.cs |
Added test case for .cgm → image/cgm conversion in GetMediaType_WithExtension_ReturnsCorrectMediaType test (line 61), and added test case for image/cgm → .cgm conversion in GetExtension_WithMediaType_ReturnsCorrectExtension test (line 122) |
Review Summary: The changes are well-implemented and follow all established patterns. The .cgm entries are correctly positioned alphabetically in both dictionaries, the count constants are accurately updated, and comprehensive test coverage has been added for both conversion directions. No issues were identified during the review.
|
Tagging subscribers to this area: @dotnet/ncl |
Description
Adds IANA-registered
.cgmextension (ISO 8632 Computer GraphicsMetafile) toMediaTypeMap.cs:.cgm↔image/cgmExtensionToMediaTypeCount(403→404),MediaTypeToExtensionCount(294→295)Customer Impact
Applications using
MediaTypeMapto resolve.cgmfiles will now correctly identify them asimage/cgminstead of returning null. Affects technical documentation, engineering, and aviation industry applications that use CGM format.Regression
No. This adds new functionality without modifying existing mappings.
Testing
.cgmextension in both directionsRisk
Low. Changes are purely additive (new dictionary entries only), no existing behavior modified.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
012af33cbd3644b387e6b11417ae90d1/home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Net.Mail.Functional.Tests.runtimeconfig.json --depsfile System.Net.Mail.Functional.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.3-beta.25613.101/build/../tools/net/xunit.console.dll System.Net.Mail.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing(dns block)02e2f870988a42a581f57bff00771dab/home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Net.Mail.Functional.Tests.runtimeconfig.json --depsfile System.Net.Mail.Functional.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.3-beta.25613.101/build/../tools/net/xunit.console.dll System.Net.Mail.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing(dns block)3e7368d4357249b6b3f95fbbcd7b1c93/home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Net.Mail.Functional.Tests.runtimeconfig.json --depsfile System.Net.Mail.Functional.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.3-beta.25613.101/build/../tools/net/xunit.console.dll System.Net.Mail.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing(dns block)587579ce91d347bf8950d8853485e7b9/home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Net.Mail.Functional.Tests.runtimeconfig.json --depsfile System.Net.Mail.Functional.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.3-beta.25613.101/build/../tools/net/xunit.console.dll System.Net.Mail.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing(dns block)95059a425b004bb8afc673f7715e3b84/home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet /home/REDACTED/work/runtime/runtime/artifacts/bin/testhost/net11.0-linux-Debug-x64/dotnet exec --runtimeconfig System.Net.Mail.Functional.Tests.runtimeconfig.json --depsfile System.Net.Mail.Functional.Tests.deps.json /home/REDACTED/.nuget/packages/microsoft.dotnet.xunitconsoleREDACTED/2.9.3-beta.25613.101/build/../tools/net/xunit.console.dll System.Net.Mail.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing(dns block)www.iana.org/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.