Changeset 3446555
- Timestamp:
- 01/25/2026 02:10:05 PM (3 weeks ago)
- Location:
- staticdelivr
- Files:
-
- 4 edited
- 1 copied
-
tags/2.2.1 (copied) (copied from staticdelivr/trunk)
-
tags/2.2.1/README.txt (modified) (2 diffs)
-
tags/2.2.1/includes/class-staticdelivr-images.php (modified) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/class-staticdelivr-images.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
staticdelivr/tags/2.2.1/README.txt
r3446554 r3446555 240 240 == Changelog == 241 241 242 = 2.2.1 = 243 * Fixed an issue with infinite recursion in the `rewrite_attachment_image_src` and `rewrite_attachment_url` filters. 244 * Improved handling of image URLs to prevent errors when retrieving attachment URLs. 245 242 246 = 2.2.0 = 243 247 * **Fixed: Critical Bug** - Improved recovery for malformed CDN URLs by looking up original attachment paths in the database instead of guessing dates … … 380 384 == Upgrade Notice == 381 385 386 = 2.2.1 = 387 Fixes infinite recursion in image URL filters and improves handling of attachment URLs. 388 382 389 = 2.2.0 = 383 390 Critical fix: Solves broken images issues by correctly recovering original file paths from the database for older content. -
staticdelivr/tags/2.2.1/includes/class-staticdelivr-images.php
r3446554 r3446555 542 542 543 543 if ($attachment_id) { 544 // Prevent infinite recursion: Temporarily remove our own filters 545 // because wp_get_attachment_image_src triggers the 'wp_get_attachment_image_src' filter 546 // which calls our rewrite_attachment_image_src() -> build_image_cdn_url() -> this function! 547 remove_filter('wp_get_attachment_image_src', array($this, 'rewrite_attachment_image_src'), 10); 548 remove_filter('wp_get_attachment_url', array($this, 'rewrite_attachment_url'), 10); 549 550 $original_url = false; 551 544 552 // Check if we need a specific size. 545 553 if ($filename !== $base_filename && preg_match('/-(\d+)x(\d+)(\.[^.]+)$/', $filename, $matches)) { … … 548 556 $image_src = wp_get_attachment_image_src($attachment_id, array($width, $height)); 549 557 if ($image_src && isset($image_src[0])) { 550 return$image_src[0];558 $original_url = $image_src[0]; 551 559 } 552 560 } 553 561 554 return wp_get_attachment_url($attachment_id); 562 if (!$original_url) { 563 $original_url = wp_get_attachment_url($attachment_id); 564 } 565 566 // Restore filters 567 add_filter('wp_get_attachment_image_src', array($this, 'rewrite_attachment_image_src'), 10, 4); 568 add_filter('wp_get_attachment_url', array($this, 'rewrite_attachment_url'), 10, 2); 569 570 return $original_url; 555 571 } 556 572 -
staticdelivr/trunk/README.txt
r3446554 r3446555 240 240 == Changelog == 241 241 242 = 2.2.1 = 243 * Fixed an issue with infinite recursion in the `rewrite_attachment_image_src` and `rewrite_attachment_url` filters. 244 * Improved handling of image URLs to prevent errors when retrieving attachment URLs. 245 242 246 = 2.2.0 = 243 247 * **Fixed: Critical Bug** - Improved recovery for malformed CDN URLs by looking up original attachment paths in the database instead of guessing dates … … 380 384 == Upgrade Notice == 381 385 386 = 2.2.1 = 387 Fixes infinite recursion in image URL filters and improves handling of attachment URLs. 388 382 389 = 2.2.0 = 383 390 Critical fix: Solves broken images issues by correctly recovering original file paths from the database for older content. -
staticdelivr/trunk/includes/class-staticdelivr-images.php
r3446554 r3446555 542 542 543 543 if ($attachment_id) { 544 // Prevent infinite recursion: Temporarily remove our own filters 545 // because wp_get_attachment_image_src triggers the 'wp_get_attachment_image_src' filter 546 // which calls our rewrite_attachment_image_src() -> build_image_cdn_url() -> this function! 547 remove_filter('wp_get_attachment_image_src', array($this, 'rewrite_attachment_image_src'), 10); 548 remove_filter('wp_get_attachment_url', array($this, 'rewrite_attachment_url'), 10); 549 550 $original_url = false; 551 544 552 // Check if we need a specific size. 545 553 if ($filename !== $base_filename && preg_match('/-(\d+)x(\d+)(\.[^.]+)$/', $filename, $matches)) { … … 548 556 $image_src = wp_get_attachment_image_src($attachment_id, array($width, $height)); 549 557 if ($image_src && isset($image_src[0])) { 550 return$image_src[0];558 $original_url = $image_src[0]; 551 559 } 552 560 } 553 561 554 return wp_get_attachment_url($attachment_id); 562 if (!$original_url) { 563 $original_url = wp_get_attachment_url($attachment_id); 564 } 565 566 // Restore filters 567 add_filter('wp_get_attachment_image_src', array($this, 'rewrite_attachment_image_src'), 10, 4); 568 add_filter('wp_get_attachment_url', array($this, 'rewrite_attachment_url'), 10, 2); 569 570 return $original_url; 555 571 } 556 572
Note: See TracChangeset
for help on using the changeset viewer.