10up / windows-azure-storage

Use the Microsoft Azure Storage service to host your website's media files.
https://wordpress.org/plugins/windows-azure-storage/
BSD 2-Clause "Simplified" License
62 stars 46 forks source link

Add PDF replacement feature #220

Closed hugosolar closed 5 months ago

hugosolar commented 6 months ago

Description of the Change

We've seen some situations where users want to replace a PDF file with an updated version (CV for example) This PR adds to the plugin the ability to replace pdf files (for now) using a new method to copy the blob and replace it with the uploaded file. There's a new method called copy_media_to_blob_storage in helpers and also a new copy_blob method in the API client this uses the Copy Blob operation described here: https://learn.microsoft.com/en-us/rest/api/storageservices/Copy-Blob

There's also a new button added in the media uploader that holds the workflow to replace the document

Open discussion for addressing images

We should have a discussion on how to approach image replacements since an image of a different orientation can be uploaded and image sizes of the image to be replaced won't match, so I was thinking on two paths

How to test the Change

To test this:

Changelog Entry

Added - New feature to replace PDF files at the blob storage level Fixed - Bug fix. Fixed a bug with the transient generated for displaying progress

Credits

@hugosolar

Checklist:

jeffpaul commented 6 months ago

@hugosolar looks like failing e2e tests, could you check on those please?

hugosolar commented 5 months ago

@jeffpaul I think this is related to the constants passed to Cypress related to the account name & key

here https://github.com/hugosolar/windows-azure-storage/blob/022290b32e875986dc4b790be6891c56ad736c2d/tests/cypress/e2e/settings.test.js#L12

On a previous PR, I remember we faced the same situation and @Sidsector9 was able to fix it let me know otherwise

rickalee commented 5 months ago

@hugosolar Some feedback to address and need to address the E2E tests.