Copied to clipboard

Flag this post as spam?

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


  • Eli Estes 9 posts 119 karma points
    Feb 23, 2021 @ 23:29
    Eli Estes
    0

    Migrate from S3 to Azure Blob Storage on Umbraco Cloud

    We started off using the S3 filesystem provider library (https://github.com/ElijahGlover/Umbraco-S3-Provider) on Umbraco Cloud. Somewhat recently there was a migration to Azure Blob Storage that we were unaware of and we ended up with some media on Azure Blob Storage and some still on the S3 bucket. To get them all on the same storage, I copied everything from the S3 bucket to the Azure Blob Storage account, changed all the configuration settings to use the Azure Filesystem provider, and removed the S3 packages. However, some of the media files still link to the s3://.../media url and others link to /media. I checked the database (specifically the "mediaPath" column) and it doesn't appear to be coming from there. Does anyone know how I could fix this on Umbraco Cloud so that they're all pointing to /media?

  • Eli Estes 9 posts 119 karma points
    Mar 08, 2021 @ 16:13
    Eli Estes
    100

    I found where the url was coming from. It's in the cmsPropertyData table. I wrote the queries below to find and fix them. But it turned out there were only 22 media items like this, so I opted to just re-upload the image manually.

    select cpd.dataNtext, cm.mediaPath, CONCAT('{"src": "', cm.mediaPath, '", "focalPoint": { "left": 0.5, "top": 0.5 } }')
    from cmsPropertyData as cpd
    join cmsPropertyType as cpt on cpd.propertytypeid = cpt.id
    join cmsContentType as cct on cct.nodeId = cpt.contentTypeId
    join cmsMedia as cm on cpd.contentNodeId = cm.nodeId
    where cct.Alias = 'Image'
        and cpt.Alias = 'umbracoFile'
        and cpd.dataNtext like '%s3-us-west-2%'
    
    select cpd.dataNvarchar, REPLACE(cpd.dataNvarchar, 'https://s3-us-west-2.amazonaws.com/{bucket name}', '')
    from cmsPropertyData as cpd
    join cmsPropertyType as cpt on cpd.propertytypeid = cpt.id
    join cmsContentType as cct on cct.nodeId = cpt.contentTypeId
    where cct.Alias = 'File'
        and cpt.Alias = 'umbracoFile'
        and cpd.dataNvarchar like '%s3-us-west-2%'
    
Please Sign in or register to post replies

Write your reply to:

Draft