Generated paths contains language prefix

Created on 10 January 2023, almost 2 years ago
Updated 1 June 2023, over 1 year ago

Problem/Motivation

On a multi-language site and the generated signature path in the /.well-known/security.txt file contains the current language.
And that path give a 403.
It works well when i remove the language prefix in the signature path.

Ex.
https://my.domain.be/nl/.well-known/security.txt.sig => 403
https://my.domain.be/.well-known/security.txt.sig => OK

Steps to reproduce

During the config of the security.txt module on a multilanguage site within the 'Sign' config form.

Proposed resolution

Generate URL's without the language-prefix. ( See on line 36 in function 'getSecuritytxtFile' )
But i don't know if that's even possible.

🐛 Bug report
Status

Active

Version

1.2

Component

Code

Created by

🇧🇪Belgium pbosmans

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.

  • 🇺🇸United States Kristen Pol Santa Cruz, CA, USA

    It would be easy enough to strip the path prefix from the URL.

    You can get the path prefixes with:

    $prefixes = \Drupal::config('language.negotiation')->get('url.prefixes');
    

    So... just loop through these and strip from signature_url if it starts with that + /.

    Does someone want to create a patch/MR?

  • Status changed to Needs review over 1 year ago
  • 🇮🇳India subhashuyadav Mumbai

    Here is fix for the language prefix

  • 🇧🇬Bulgaria mirondi

    Here is a fix compatible with the latest versions of the module

  • 🇳🇱Netherlands johan_vm Tilburg

    When adding this patch it conflicted with issue: 3375732, so I combined both into a new patch for those who need it.

Production build 0.71.5 2024