Skip to content

Commit f42e510

Browse files
authored
Merge pull request #7120 from umbraco/cms/add-note-to-unique-media-scheme
Add clarifying detail to documentation about UniqueMediaScheme
2 parents 0028787 + d150087 commit f42e510

File tree

1 file changed

+8
-2
lines changed
  • 16/umbraco-cms/extending/filesystemproviders

1 file changed

+8
-2
lines changed

16/umbraco-cms/extending/filesystemproviders/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,17 @@ You can then access the configured file system provider through `_mediaFileManag
140140

141141
The MediaPath Scheme defines the current set of rules that decide the format of the Media Path when it is saved into the media archive wherever it is located.
142142

143-
By default the MediaPath scheme used by Umbraco is the `UniqueMediaPathScheme` this generates a unique 'folder' to place the uploaded image in eg.
143+
By default the MediaPath scheme used by Umbraco is the `UniqueMediaPathScheme` this generates a 'folder' to place the uploaded image in, for example:
144144

145145
`/media/dozdrg2f/mylovelyimage.jpg`
146146

147-
`/media` is defined by the PhysicalFileSystem and 'dozdrg2f' is generated by the `UniqueMediaPathScheme`.
147+
`/media` is defined by the PhysicalFileSystem and `dozdrg2f` is generated by the `UniqueMediaPathScheme`.
148+
149+
{% hint style="info" %}
150+
The folder generated by `UniqueMediaPathScheme` is not strictly unique, as it's based on the first eight characters of the GUID for the media item. In practice, with randomly generated GUIDs, a collision is unlikely.
151+
152+
There is an increased possibility of generating colliding paths if creating media programmatically and setting keys using version 7 "ordered" GUIDs via `Guid.CreateVersion7()`. As such these should be avoided. `UniqueMediaPathScheme` will throw an exception if it detects they have been used. Any manually created keys should use `Guid.NewGuid()`.
153+
{% endhint %}
148154

149155
You can create your own logic for the path by implementing `IMediaPathScheme` and setting it during composition with:
150156

0 commit comments

Comments
 (0)