Url::fromUserInput() returning base scheme that cannot be resolved by FileSystem::realpath()

Created on 15 August 2016, about 8 years ago
Updated 8 July 2023, about 1 year ago

We're collecting an image path from the user (not unlike what the theme settings use for favicons + logos) as opposed to uploading a file, and have discovered that we are getting empty values trying to resolve this to a system-absolute path using the following mechanism:

~ # drush ev "echo \Drupal\Core\Url::fromUserInput('/themes/custom/league_amp/logo.gif')->getUri() . \"\n\";"
base:themes/custom/league_amp/logo.gif
~ # drush ev "echo \Drupal::service('file_system')->realpath('base:themes/custom/league_amp/logo.gif') . \"\n\";"

~ #

Digging a bit, it looks like the scheme validation is failing. I'm also unable to find a stream wrapper to handle the base scheme in core.

Anyone know if this is a known issue or if I'm just mixing incompatible calls? It really seems like the Url class should be returning a local URI that the FileSystem class can properly process...

πŸ› Bug report
Status

Closed: outdated

Version

9.5

Component
File systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States arpieb

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024