Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ali Camlibel 2 posts 72 karma points
    3 days ago
    Ali Camlibel
    0

    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?

  • Afreed 54 posts 261 karma points
    2 days ago
    Afreed
    0

    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.

    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.

Please Sign in or register to post replies

Write your reply to:

Draft