From 9dbc20a363c760962e5b9f9b877967cc6383a2da Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 14 Jul 2021 09:51:38 +0100 Subject: [PATCH 1/2] Prevent variable polution --- php/sync/class-storage.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/sync/class-storage.php b/php/sync/class-storage.php index 5b7de8ef4..ece5f6a09 100644 --- a/php/sync/class-storage.php +++ b/php/sync/class-storage.php @@ -189,9 +189,9 @@ public function sync( $attachment_id ) { switch ( $this->settings['offload'] ) { case 'cld': $this->remove_local_assets( $attachment_id ); - $url = $this->media->cloudinary_url( $attachment_id, false ); - $url = remove_query_arg( '_i', $url ); - update_post_meta( $attachment_id, '_wp_attached_file', $url ); + $cloudinary_url = $this->media->cloudinary_url( $attachment_id, false ); + $cloudinary_url = remove_query_arg( '_i', $cloudinary_url ); + update_post_meta( $attachment_id, '_wp_attached_file', $cloudinary_url ); break; case 'dual_low': $transformations = $this->media->get_transformation_from_meta( $attachment_id ); From fa58ae3a2b7965c8763ccbe4113541b90cbd9c5a Mon Sep 17 00:00:00 2001 From: Marco Pereirinha Date: Wed, 14 Jul 2021 09:57:01 +0100 Subject: [PATCH 2/2] Remove analytics for the download --- php/sync/class-storage.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/sync/class-storage.php b/php/sync/class-storage.php index ece5f6a09..d288927a7 100644 --- a/php/sync/class-storage.php +++ b/php/sync/class-storage.php @@ -222,6 +222,7 @@ public function sync( $attachment_id ) { $this->remove_local_assets( $attachment_id ); } $date = get_post_datetime( $attachment_id ); + $url = remove_query_arg( '_i', $url ); $this->download->download_asset( $attachment_id, $url, $date->format( 'Y/m' ) ); }