Media Types: Add public constant for Folder media type GUID#21597
Media Types: Add public constant for Folder media type GUID#21597AndyButland merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds public constants for the Folder media type GUID to improve consistency and maintainability across the codebase. The Folder media type was previously using hardcoded GUID values while other media types (Article, Audio, File, Image, Svg, Video) already had defined constants.
Changes:
- Added
Folder(string) andFolderGuid(Guid) constants toConstants.MediaTypes.Guidsclass - Replaced hardcoded GUID string in
DatabaseDataCreator.CreateNodeDataForMediaTypes()with the new constants - Replaced hardcoded GUID in the
EnsureDefaultMediaFolderHasDefaultCollectionmigration with the new constant
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Umbraco.Core/Constants-MediaTypes.cs | Adds Folder and FolderGuid constants following the established pattern for other media types |
| src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs | Replaces hardcoded GUID with new constants in Folder media type creation |
| src/Umbraco.Infrastructure/Migrations/Upgrade/V_17_0_0/EnsureDefaultMediaFolderHasDefaultCollection.cs | Replaces hardcoded GUID with FolderGuid constant in migration |
|
@AndyButland Thanks. Can you modify my code here in this PR as well? It currently does a lookup, but there is no need to since the ID is constant and known: From PR #21216 Alternatively, I can submit my own PR to do that, if you think that is better. Just want to make sure we get the most performant implementation for 17.2. |
…ching for media items.
|
@arknu - thanks, I've updated to use the known folder key here too. |
Description
Follows up on #21461 and in particular the comment #21461 (comment) which created constants for media type GUID identifiers.
This earler PR missed the "Folder" media type though, so I've added it in here.
Change Summary
FolderandFolderGuidconstants toConstants.MediaTypes.Guidsfor consistency with other media types (Article, Audio, File, Image, Svg, Video)DatabaseDataCreatorandEnsureDefaultMediaFolderHasDefaultCollectionmigration to use the new constant instead of hardcoded GUIDs