Enhance image URL handling when the image is from DAM inside the editor #1008
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and bug fixes related to DAM (Digital Asset Management) image handling, unoptimized URL extraction, and test coverage. The main focus is on enhancing the reliability and accuracy of image URL normalization and attachment ID resolution for DAM/offloaded images, as well as improving test stability.
DAM/offload image handling and attachment resolution:
is_dam_urlinto theOptml_Dam_Offload_Utilstrait and updating its usage throughout the codebase for better encapsulation and reuse. [1] [2]attachment_url_to_post_idmethod to correctly extract attachment IDs from DAM/offloaded image URLs using a new helper (get_attachement_id_from_optimole_id) that queries the database based on the Optimole ID. [1] [2] [3]Unoptimized URL extraction and normalization:
get_unoptimized_urlmethod to correctly handle uploaded images with/id:patterns, ensuring the original URL is extracted and returned as expected.get_optimized_image_urlto always extract the unoptimized URL before rebuilding the Optimole URL, preventing double-optimization issues.Testing and developer experience:
get_unoptimized_url, covering regular, offloaded, custom domain, and edge case URLs to ensure robust behavior.https://secure.helpscout.net/conversation/3142052654/476408?viewId=2353196