It looks like it's not possible in v13 and earlier because the ToFriendlyName method is part of a static class (StringExtensions) under Umbraco.Extensions, and static methods can't be overridden directly.
var mediaItemName = fileName.ToFriendlyName();
This sanitizes the name. Since it's static, there's no straightforward way to override it.
If you really need to change its behavior, you could consider patching it dynamically using something like HarmonyLib. However, I wouldn't recommend it unless absolutely necessary, as it involves injecting custom logic at runtime, which can complicate debugging and maintenance.
Umbraco is renaming media files' node names
Hello, I would like to know if there was some way of retaining the original file name as the node name when a file gets uploaded?
For example, uploading the file my_1_document.pdf would result in a node name of My 1 Document.
Seems Umbraco is converting it to more of a human readable format, but I would like to disable this. Any way of disabling this functionality?
Hey Ali,
It looks like it's not possible in v13 and earlier because the ToFriendlyName method is part of a static class (StringExtensions) under Umbraco.Extensions, and static methods can't be overridden directly.
This sanitizes the name. Since it's static, there's no straightforward way to override it.
If you really need to change its behavior, you could consider patching it dynamically using something like HarmonyLib. However, I wouldn't recommend it unless absolutely necessary, as it involves injecting custom logic at runtime, which can complicate debugging and maintenance.
is working on a reply...