If a suggestion has a NULL in query string, LinkitFilter replaces with an empty string

Created on 8 November 2023, about 1 year ago
Updated 11 January 2024, 11 months ago

Problem/Motivation

If a suggestion has a NULL in query string, LinkitFilter replaces with an empty string.

Steps to reproduce

This happens to me in the scenario of linking media when using Media Entity Download module.
I'm using the patch at https://www.drupal.org/project/media_entity_download/issues/3391565#comm... ✨ Compatibility with Linkit 6 Needs work .

LinkitFilter parses the URL, but str_parse converts any NULL value to an empty string, so something like media/2/download?inline is converted to media/2/download?inline= (see equals), which won't work as expected.

Proposed resolution

We probably shouldn't assume that any query arg with an empty string is equivalent to NULL, but I think it's safe to assume that any query string that was NULL and is now empty, should be NULL. Sadly I don't think there's a 100% safe way with str_parse.

Remaining tasks

We might want to add tests here. Guidance is appreciated.

User interface changes

None.

API changes

NULL args are kept as NULL.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

6.1

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024