preg_split in _filter_url breaks for long html tags (improvement for 3360661)

Created on 23 August 2023, over 1 year ago
Updated 10 October 2023, about 1 year ago

Problem/Motivation

WSOD Error: Embed\Exceptions\InvalidUrlException: Could not resolve host: example in Embed\Embed::process() (line 144 of /var/www/html/vendor/embed/embed/src/Embed.php).

TL;DR: url_embed is not properly patched

At the moment we have 5 patches for url_embed (https://git.drupalcode.org/project/social/-/blob/11.9.x/composer.json#L99)

"drupal/url_embed": {
                "Translate dialog title": "https://www.drupal.org/files/issues/2018-03-16/url_embed_translate_dialog_title-2953591-2.patch",
                "Improve how the module deals with non-embeddable URLs & WSODs (See: https://www.drupal.org/project/social/issues/2930457#comment-13973067)": "https://www.drupal.org/files/issues/2021-01-22/urlembed-non-embeddable-urls-2761187-opensocial-combined-21.patch",
                "Support for Facebook/Instagram API changes - add access token settings": "https://www.drupal.org/files/issues/2021-07-14/url_embed-add-facebook-access-token-config-3177860-opensocial-2.patch",
                "Embed Preview throws 403 forbidden": "https://www.drupal.org/files/issues/2023-03-17/url_embed-preview-403-3285139-10.patch",
                "3360661 - preg_split in _filter_url breaks for long html tags" :"https://www.drupal.org/files/issues/2023-05-16/3360661-url_embed-preg-split.patch"
            },

By mistake, patch 5 " https://www.drupal.org/files/issues/2023-05-16/3360661-url_embed-preg-sp... " ( issue: 3360661 ) is partly overriding the fix from patch 2
" https://www.drupal.org/files/issues/2021-01-22/urlembed-non-embeddable-u... " ( issue: 2930457 ) which is causing regression fixed by patch 2.

Steps to reproduce

HTT 1: Follow the steps to reproduce of https://www.drupal.org/project/social/issues/3360661
HTT 2: Follow the steps to reproduce of https://www.drupal.org/project/social/issues/3382821
Both issues should provide an expected result.

HTT3:
- Install clean version of Open Social
- enable social_embed module
- Create a post by visiting post/add/post and insert content: "Broken link example: http://example/idontexist and working Youtube embed example: https://youtu.be/ojafuCcUZzU"
- Go to homepage to confirm that post is correctly displayed

Proposed resolution

Update patch 5 ("3360661 - preg_split in _filter_url breaks for long html tags" :" https://www.drupal.org/files/issues/2023-05-16/3360661-url_embed-preg-sp... ") in a way that it will not override the code from patch 2.

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Fixed

Version

11.9

Component

Other

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024