Copied to clipboard

Flag this post as spam?

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


  • Genc Kastrati 86 posts 401 karma points
    Nov 25, 2020 @ 15:56
    Genc Kastrati
    0

    Azure blob storage: Keep old links

    Hellos,

    Has anyone figured out a way to keep old links on Azure Blob storage when you rewrite a media file on Umbraco Cloud?

    For example old file like this: /media/3247/lfaselectedlist_en.pdf

    Is getting changed to this: /media/8d8915a226f3c26/lfaselectedlist_en.pdf

    Some of our users rely on these URLs not changing. Any help appreciated! We did have the code that kept those links unchanged on standard Media file system but it isnt working on Blob storage. Thank you! Genc

  • Genc Kastrati 86 posts 401 karma points
    Nov 30, 2020 @ 10:53
    Genc Kastrati
    100

    Hi all,

    A quick update on this, got it sorted out thx to Umbraco Support.

    Here is how to fix:

    Add:

     [ComposeAfter(typeof(AzureBlobComposer))]
    

    And, if you are compiling it in Core:

    using Umbraco.Cloud.StorageProviders.AzureBlob;
    

    Before your custom method. So your whole method looks like this:

    [RuntimeLevel(MinLevel = RuntimeLevel.Run)]
    [ComposeAfter(typeof(AzureBlobComposer))]
    public class MyComposer : IUserComposer
    {
        public void Compose(Composition composition)
        {
            composition.RegisterUnique<IMediaPathScheme, OriginalMediaPathScheme>();
        }
    }
    

    That's it! Your old links will be kept on Azure Blob Storage. Thx.

Please Sign in or register to post replies

Write your reply to:

Draft