File paths on multisite with domain subfolder broken

Created on 3 August 2020, over 4 years ago
Updated 2 February 2023, almost 2 years ago

Problem/Motivation

When you use this module on a multisite setup and the sites subfolder of the multisite is the same as the domain name the module strips out both parts the domain name and the subfolder in sites directory.

Related to this issue (but it did not fix it completely): https://www.drupal.org/project/link_fix_absolute_urls/issues/3161935 β†’

Steps to reproduce

Enter a link to a file of a multisite into a link field and save.

Example link: https://www.example.com/sites/example.com/files/some-file.pdf

Expected result: /sites/example.com/files/some-file.pdf
Actual result: /sites//files/some-file.pdf

Proposed resolution

Do not use str_replace() as it replaces all occurrences of the found string and not only the first one, use preg_replace() with limit of 1 instead.

Remaining tasks

  • Fix test/or create a new one for this exact use case

User interface changes

-

API changes

-

Data model changes

-

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria ndeet Vienna

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