From d1f9762ecb26f3a1542b368edb28a8aca918d8f7 Mon Sep 17 00:00:00 2001 From: Hugo Solar Date: Wed, 17 Jul 2024 10:46:43 -0400 Subject: [PATCH 1/5] fix path issue with override container --- windows-azure-storage-util.php | 7 ++++--- windows-azure-storage.php | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/windows-azure-storage-util.php b/windows-azure-storage-util.php index 3f9feee..27187fa 100644 --- a/windows-azure-storage-util.php +++ b/windows-azure-storage-util.php @@ -315,7 +315,7 @@ protected static function _maybe_rewrite_cname( $cname ) { public static function get_storage_url_base( $append_container = true ) { $azure_storage_account_name = \Windows_Azure_Helper::get_account_name(); $default_azure_storage_account_container_name = \Windows_Azure_Helper::get_default_container(); - $azure_storage_override_container_path = \Windows_Azure_Helper::get_azure_storage_override_container_path(); + $azure_storage_override_container_path = \Windows_Azure_Helper::get_azure_storage_override_container_path(); /** * Filter the blob URL protocol to force a specific one. * @@ -337,11 +337,12 @@ public static function get_storage_url_base( $append_container = true ) { } // Get CNAME if defined. - $cname = \Windows_Azure_Helper::get_cname(); + $cname = \Windows_Azure_Helper::get_cname(); + $maybe_override_container_name = ! empty( $azure_storage_override_container_path ) ? $azure_storage_override_container_path : $default_azure_storage_account_container_name; if ( ! empty( $cname ) ) { $url = sprintf( '%1$s/%2$s', $cname, - $append_container = ! empty( $azure_storage_override_container_path ) ? $azure_storage_override_container_path : $default_azure_storage_account_container_name + $append_container = $append_container ? $maybe_override_container_name : '' ); } else { $blob_storage_host_name = \Windows_Azure_Helper::get_hostname(); diff --git a/windows-azure-storage.php b/windows-azure-storage.php index fe62f00..73db609 100644 --- a/windows-azure-storage.php +++ b/windows-azure-storage.php @@ -874,14 +874,17 @@ function windows_azure_storage_plugin_menu() { * @return array The filtered $sources array. */ function windows_azure_storage_wp_calculate_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ) { - $media_info = get_post_meta( $attachment_id, 'windows_azure_storage_info', true ); + $media_info = get_post_meta( $attachment_id, 'windows_azure_storage_info', true ); + $default_azure_storage_account_container_name = \Windows_Azure_Helper::get_default_container(); + $azure_storage_override_container_path = \Windows_Azure_Helper::get_azure_storage_override_container_path(); + $maybe_override_container_path = ! empty( $azure_storage_override_container_path ) ? $azure_storage_override_container_path : $default_azure_storage_account_container_name; // If a CNAME is configured, make sure only 'http' is used for the protocol. $azure_cname = \Windows_Azure_Helper::get_cname(); $esc_url_protocols = ! empty( $azure_cname ) ? array( 'https', 'http', '//' ) : null; if ( ! empty( $media_info ) ) { - $base_url = trailingslashit( WindowsAzureStorageUtil::get_storage_url_base( false ) . $media_info['container'] ); + $base_url = trailingslashit( WindowsAzureStorageUtil::get_storage_url_base( false ) . $maybe_override_container_path ); foreach ( $sources as &$source ) { $img_filename = substr( $source['url'], strrpos( $source['url'], '/' ) + 1 ); From fa471c57cfe7c2b54817e632079033faeba2fb72 Mon Sep 17 00:00:00 2001 From: Hugo Solar Date: Wed, 17 Jul 2024 11:19:19 -0400 Subject: [PATCH 2/5] fix format --- windows-azure-storage-util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows-azure-storage-util.php b/windows-azure-storage-util.php index 27187fa..b6ae44e 100644 --- a/windows-azure-storage-util.php +++ b/windows-azure-storage-util.php @@ -315,7 +315,7 @@ protected static function _maybe_rewrite_cname( $cname ) { public static function get_storage_url_base( $append_container = true ) { $azure_storage_account_name = \Windows_Azure_Helper::get_account_name(); $default_azure_storage_account_container_name = \Windows_Azure_Helper::get_default_container(); - $azure_storage_override_container_path = \Windows_Azure_Helper::get_azure_storage_override_container_path(); + $azure_storage_override_container_path = \Windows_Azure_Helper::get_azure_storage_override_container_path(); /** * Filter the blob URL protocol to force a specific one. * From e9e6d3de1fd8c1cdb2237b92c56593358536c2f7 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 17 Jul 2024 10:26:01 -0600 Subject: [PATCH 3/5] Version bump to 4.5.1 --- js/windows-azure-storage-admin.js | 2 +- js/windows-azure-storage-media-browser.js | 2 +- js/windows-azure-storage-media-replace.js | 12 ++++++------ package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 2 +- windows-azure-storage.php | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/js/windows-azure-storage-admin.js b/js/windows-azure-storage-admin.js index 434a64b..2335015 100644 --- a/js/windows-azure-storage-admin.js +++ b/js/windows-azure-storage-admin.js @@ -1,4 +1,4 @@ -/*! - v4.5.0 +/*! - v4.5.1 * https://github.com/10up/windows-azure-storage#readme * Copyright (c) 2024; */ (function ( $, window, undefined ) { diff --git a/js/windows-azure-storage-media-browser.js b/js/windows-azure-storage-media-browser.js index 0b2b642..2dd226a 100644 --- a/js/windows-azure-storage-media-browser.js +++ b/js/windows-azure-storage-media-browser.js @@ -1,4 +1,4 @@ -/*! - v4.5.0 +/*! - v4.5.1 * https://github.com/10up/windows-azure-storage#readme * Copyright (c) 2024; */ window.wp = window.wp || {}; diff --git a/js/windows-azure-storage-media-replace.js b/js/windows-azure-storage-media-replace.js index a2ac259..8f30124 100644 --- a/js/windows-azure-storage-media-replace.js +++ b/js/windows-azure-storage-media-replace.js @@ -1,15 +1,15 @@ -/*! - v4.5.0 +/*! - v4.5.1 * https://github.com/10up/windows-azure-storage#readme * Copyright (c) 2024; */ function generateCacheVar(length) { var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; var result = ''; - + for (var i = 0; i < length; i++) { var randomIndex = Math.floor(Math.random() * characters.length); result += characters[randomIndex]; } - + return result; } @@ -27,7 +27,7 @@ var alertMessage = function(message,status,fadeOutSeconds) { var replaceMedia = function(attachmentID) { var mediaUploader; - + if (mediaUploader) { mediaUploader.open(); return; @@ -93,9 +93,9 @@ var replaceMedia = function(attachmentID) { console.error("AJAX request failed: ", status, error); } }); - + }); - + mediaUploader.on('open', function(){ mediaUploader.reset(); var context = jQuery(mediaUploader.el); diff --git a/package-lock.json b/package-lock.json index 0c363ee..357f5e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "windows-azure-storage", - "version": "4.5.0", + "version": "4.5.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "windows-azure-storage", - "version": "4.5.0", + "version": "4.5.1", "license": "BSD-2-Clause", "dependencies": { "grunt": "^1.5.3", diff --git a/package.json b/package.json index f22f19a..bdfeb99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "windows-azure-storage", - "version": "4.5.0", + "version": "4.5.1", "description": "Use the Microsoft Azure Storage service to host your website's media files.", "homepage": "https://github.com/10up/windows-azure-storage#readme", "bugs": { diff --git a/readme.txt b/readme.txt index 651ba6d..ddbc836 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: msopentech, 10up, morganestes, stevegrunwell, lpawlik, ritteshpatel, johnwatkins0, rickalee, eflorea, phyrax, ravichandra, jeffpaul Tags: Microsoft Azure Storage, Media Files, Upload, CDN, blob storage Tested up to: 6.6 -Stable tag: 4.5.0 +Stable tag: 4.5.1 License: BSD 2-Clause License URI: http://www.opensource.org/licenses/bsd-license.php diff --git a/windows-azure-storage.php b/windows-azure-storage.php index 73db609..c551464 100644 --- a/windows-azure-storage.php +++ b/windows-azure-storage.php @@ -3,7 +3,7 @@ * Plugin Name: Microsoft Azure Storage for WordPress * Plugin URI: https://wordpress.org/plugins/windows-azure-storage/ * Description: Use the Microsoft Azure Storage service to host your website's media files. - * Version: 4.5.0 + * Version: 4.5.1 * Requires at least: 6.4 * Requires PHP: 8.0 * Author: 10up, Microsoft Open Technologies @@ -62,7 +62,7 @@ define( 'MSFT_AZURE_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'MSFT_AZURE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'MSFT_AZURE_PLUGIN_LEGACY_MEDIA_URL', get_admin_url( get_current_blog_id(), 'media-upload.php' ) ); -define( 'MSFT_AZURE_PLUGIN_VERSION', '4.5.0' ); +define( 'MSFT_AZURE_PLUGIN_VERSION', '4.5.1' ); /** * Get the minimum version of PHP required by this plugin. From e1c8ef80e31cd67ce0793f66472d4fe91f484554 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 17 Jul 2024 10:28:55 -0600 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 5 +++++ readme.txt | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9598c04..acc4b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file, per [the Ke ## [Unreleased] - TBD +## [4.5.1] - 2024-07-17 +### Fixed +- Fix path issue that duplicates the container name in URL paths (props [@hugosolar](https://github.com/hugosolar), [@cally423](https://github.com/cally423), [@Besdima](https://github.com/Besdima), [@ms2oo8](https://github.com/ms2oo8), [@BCornelissen](https://github.com/BCornelissen), [@dkotter](https://github.com/dkotter) via [#246](https://github.com/10up/windows-azure-storage/pull/246)). + ## [4.5.0] - 2024-07-15 ### Added - Feature to replace images at the blob storage level (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@dkotter](https://github.com/dkotter) via [#230](https://github.com/10up/windows-azure-storage/pull/230)). @@ -285,6 +289,7 @@ All notable changes to this project will be documented in this file, per [the Ke - First release of Microsoft Azure Storage plugin for WordPress. [Unreleased]: https://github.com/10up/windows-azure-storage/compare/trunk...develop +[4.5.1]: https://github.com/10up/windows-azure-storage/compare/4.5.0...4.5.1 [4.5.0]: https://github.com/10up/windows-azure-storage/compare/4.4.2...4.5.0 [4.4.2]: https://github.com/10up/windows-azure-storage/compare/4.4.1...4.4.2 [4.4.1]: https://github.com/10up/windows-azure-storage/compare/4.4.0...4.4.1 diff --git a/readme.txt b/readme.txt index ddbc836..5b7de4a 100644 --- a/readme.txt +++ b/readme.txt @@ -35,6 +35,9 @@ See Settings->Microsoft Azure for more information. == Changelog == += 4.5.1 - 2024-07-17 = +* **Fixed:** Fix path issue that duplicates the container name in URL paths (props [@hugosolar](https://github.com/hugosolar), [@cally423](https://github.com/cally423), [@Besdima](https://github.com/Besdima), [@ms2oo8](https://github.com/ms2oo8), [@BCornelissen](https://github.com/BCornelissen), [@dkotter](https://github.com/dkotter) via [#246](https://github.com/10up/windows-azure-storage/pull/246)). + = 4.5.0 - 2024-07-15 = * **Added:** Feature to replace images at the blob storage level (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@dkotter](https://github.com/dkotter) via [#230](https://github.com/10up/windows-azure-storage/pull/230)). * **Added:** Constant for `MICROSOFT_AZURE_OVERRIDE_CONTAINER_PATH` (props [@rickalee](https://github.com/rickalee), [@engrshakirali](https://github.com/engrshakirali), [@hugosolar](https://github.com/hugosolar) via [#240](https://github.com/10up/windows-azure-storage/pull/240)). From c881d79e0b1b53bfdd09b00ce3c843c6aaf12042 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Wed, 17 Jul 2024 10:31:49 -0600 Subject: [PATCH 5/5] Update CREDITS.md --- CREDITS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CREDITS.md b/CREDITS.md index 4ce59a9..422ba02 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -12,7 +12,7 @@ The following individuals are responsible for curating the list of issues, respo Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc. -[Microsoft Open Technologies (@msopentech)](https://github.com/msopentech), [10up (@10up)](https://github.com/10up), [Morgan Estes (@morganestes)](https://github.com/morganestes), [Steve Grunwell (@stevegrunwell)](https://github.com/stevegrunwell), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Allan Collins (@allan23)](https://github.com/allan23), [(@jpaarhuis)](https://github.com/jpaarhuis), [Thorsten Ott (@tott)](https://github.com/tott), [Scott Lee (@scottlee)](https://github.com/scottlee), [Emmanuel Fidelino (@EmmanF)](https://github.com/EmmanF), [Joey Blake (@joeyblake)](https://github.com/joeyblake), [(@mrgregwaugh)](https://github.com/mrgregwaugh), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Brad Parbs (@bradp)](https://github.com/bradp), [Bibin Kurian (@bibinkurian)](https://github.com/bibinkurian), [Anu Thomas Chandy (@anuchandy)](https://github.com/anuchandy), [Suman Chawla (@suchawla)](https://github.com/suchawla), [(@mksunitha)](https://profiles.wordpress.org/mksunitha/), [Justin Kopepasah (@kopepasah)](https://github.com/kopepasah), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jay Wood (@jaywood)](https://github.com/jaywood), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Ricardo Moraleida (@moraleida)](https://github.com/moraleida), [Kentaro Ohkouchi (@nanasess)](https://github.com/nanasess), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [(@lostfields)](https://github.com/lostfields), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Jake Edwards (@ShadowXVII)](https://github.com/ShadowXVII), [Cole Geissinger (@colegeissinger)](https://github.com/colegeissinger), [(@cally423)](https://github.com/cally423), [(@FreuxF)](https://github.com/FreuxF), [Eric Greenfield (@saltnpixels)](https://github.com/saltnpixels), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Marius L. Jensen (@Clorith)](https://github.com/Clorith), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Debabrata Karfa (@debabratakarfa)](https://github.com/debabratakarfa), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Andrew Herder (@superpowered)](https://github.com/superpowered), [Giovanbattista Amato (@gioamato)](https://github.com/gioamato), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Radovan Šmitala (@radeno)](https://github.com/radeno), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Hugo Solar (@hugosolar)](https://github.com/hugosolar), [Mark Waser (@MWaser)](https://github.com/MWaser), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Sarah Nicholson (@sarahannnicholson)](https://github.com/sarahannnicholson), [Nicola Peluchetti (@nicoladj77)](https://github.com/nicoladj77), [Shakir Ali (@engrshakirali)](https://github.com/engrshakirali), [Ali Awwad (@ali-awwad)](https://github.com/ali-awwad), [(@glowmedia)](https://github.com/glowmedia). +[Microsoft Open Technologies (@msopentech)](https://github.com/msopentech), [10up (@10up)](https://github.com/10up), [Morgan Estes (@morganestes)](https://github.com/morganestes), [Steve Grunwell (@stevegrunwell)](https://github.com/stevegrunwell), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Allan Collins (@allan23)](https://github.com/allan23), [(@jpaarhuis)](https://github.com/jpaarhuis), [Thorsten Ott (@tott)](https://github.com/tott), [Scott Lee (@scottlee)](https://github.com/scottlee), [Emmanuel Fidelino (@EmmanF)](https://github.com/EmmanF), [Joey Blake (@joeyblake)](https://github.com/joeyblake), [(@mrgregwaugh)](https://github.com/mrgregwaugh), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Brad Parbs (@bradp)](https://github.com/bradp), [Bibin Kurian (@bibinkurian)](https://github.com/bibinkurian), [Anu Thomas Chandy (@anuchandy)](https://github.com/anuchandy), [Suman Chawla (@suchawla)](https://github.com/suchawla), [(@mksunitha)](https://profiles.wordpress.org/mksunitha/), [Justin Kopepasah (@kopepasah)](https://github.com/kopepasah), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jay Wood (@jaywood)](https://github.com/jaywood), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Ricardo Moraleida (@moraleida)](https://github.com/moraleida), [Kentaro Ohkouchi (@nanasess)](https://github.com/nanasess), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [(@lostfields)](https://github.com/lostfields), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Jake Edwards (@ShadowXVII)](https://github.com/ShadowXVII), [Cole Geissinger (@colegeissinger)](https://github.com/colegeissinger), [(@cally423)](https://github.com/cally423), [(@FreuxF)](https://github.com/FreuxF), [Eric Greenfield (@saltnpixels)](https://github.com/saltnpixels), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Marius L. Jensen (@Clorith)](https://github.com/Clorith), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Debabrata Karfa (@debabratakarfa)](https://github.com/debabratakarfa), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Andrew Herder (@superpowered)](https://github.com/superpowered), [Giovanbattista Amato (@gioamato)](https://github.com/gioamato), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Radovan Šmitala (@radeno)](https://github.com/radeno), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Hugo Solar (@hugosolar)](https://github.com/hugosolar), [Mark Waser (@MWaser)](https://github.com/MWaser), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Sarah Nicholson (@sarahannnicholson)](https://github.com/sarahannnicholson), [Nicola Peluchetti (@nicoladj77)](https://github.com/nicoladj77), [Shakir Ali (@engrshakirali)](https://github.com/engrshakirali), [Ali Awwad (@ali-awwad)](https://github.com/ali-awwad), [(@glowmedia)](https://github.com/glowmedia), [Besdima (@Besdima)](https://github.com/Besdima), [(@ms2oo8)](https://github.com/ms2oo8), [Bob Cornelissen (@BCornelissen)](https://github.com/BCornelissen). ## Libraries