Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Jul 17, 2024
2 parents 246f3fe + 0f6e905 commit 5c73c65
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion js/windows-azure-storage-admin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! - v4.5.0
/*! - v4.5.1
* https://github.com/10up/windows-azure-storage#readme
* Copyright (c) 2024; */
(function ( $, window, undefined ) {
Expand Down
2 changes: 1 addition & 1 deletion js/windows-azure-storage-media-browser.js
Original file line number Diff line number Diff line change
@@ -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 || {};
Expand Down
12 changes: 6 additions & 6 deletions js/windows-azure-storage-media-replace.js
Original file line number Diff line number Diff line change
@@ -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;
}

Expand All @@ -27,7 +27,7 @@ var alertMessage = function(message,status,fadeOutSeconds) {

var replaceMedia = function(attachmentID) {
var mediaUploader;

if (mediaUploader) {
mediaUploader.open();
return;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)).
Expand Down
7 changes: 4 additions & 3 deletions windows-azure-storage-util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions windows-azure-storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 5c73c65

Please sign in to comment.