Non-standard referrers cause WSOD

Created on 4 August 2023, 11 months ago
Updated 22 January 2024, 5 months ago

Problem/Motivation

Currently on our website the past module is used to list unsuccessful attempts of webform double opt-in via email. There are some cases when users click confirmation link not in browser but in e.g. Gmail mobile application. After opt-in the webform data are transfered to an external API, which can not respond sometimes. If API request is unsuccessful. the error is logged by past_db module.
The problem is that GMail application provides an irregular referrer: android-app://com.google.android.gm/
This kind of URLs is not supported by Drupal as external or internal, so there is an exception and WSOD on past log event page:

InvalidArgumentException: The URI 'android-app://com.google.android.gm/' is invalid. You must use a valid URI scheme. Use base: for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal. in Drupal\Core\Utility\UnroutedUrlAssembler->assemble() (line 65 of core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php).
Drupal\Core\Url->toString() (Line: 168)
Drupal\Core\Utility\LinkGenerator->generate() (Line: 33)
Drupal\past_db\PastEventViewBuilder->buildComponents() (Line: 282)

See this related issue on stackoverlow.

Steps to reproduce

TBD.

Proposed resolution

If referrer is not a valid URL, display it just as a string not as a link.

Remaining tasks

- Write steps to reproduce: not sure how other can reproduce it, because the case is a bit complicated.
An error happens on a request with non-standard referrer.
- Review a patch fixes the WSOD.

User interface changes

Link is displayed as a text if non-standard referrer is provided.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria granik Vienna

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

Comments & Activities

Production build 0.69.0 2024