Confirmation redirects URLs to internal URLs stopped being relative

Created on 4 November 2022, over 1 year ago
Updated 11 April 2023, about 1 year ago

Problem

Confirmation URL set for different confirmation types is built differently in different scenarios. Sometimes the returned URL is relative, other times it's absolute, even though a relative URL has been set.
First it was requested in this issue to make all confirmation urls relative if the set path was relative: https://www.drupal.org/project/webform/issues/3274526 β†’ but then this was a bit changed in this issue: https://www.drupal.org/project/webform/issues/3160378 β†’ . As understood from here: https://www.drupal.org/project/webform/issues/3160378#comment-13793745 β†’ , the goal was to make URLs not absolute but absolute with basepath as in (http://example.com/basepath/node/1). So we need to create the suiting URI object without making the URL absolute.

Proposed resolution

Only build an absolute redirect when an absolute path is set.

πŸ› Bug report
Status

Closed: won't fix

Version

6.2

Component

Code

Created by

πŸ‡·πŸ‡΄Romania ciprian.stavovei

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.

  • @ciprianstavovei opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡·πŸ‡΄Romania ciprian.stavovei

    I added a pull request and a new patch for this issue.

  • πŸ‡·πŸ‡΄Romania ciprian.stavovei

    Added a new patch that also adapts the unit tests with the new logic.

  • πŸ‡·πŸ‡΄Romania ciprian.stavovei

    Added the correct patch now.

  • Status changed to Needs work over 1 year ago
  • πŸ‡¦πŸ‡ΉAustria fago Vienna
    -    // Check confirmation URL using absolute path.
    +    $base_url = getenv('SIMPLETEST_BASE_URL');
    +    if ($base_url) {
    +      putenv('SIMPLETEST_BASE_URL=' . $base_url . '/base-path');
    +    }
    +
    +   // Check confirmation URL using leading "/" internal path.
         $webform_confirmation_url
    -      ->setSetting('confirmation_url', '/some-absolute-path')
    +      ->setSetting('confirmation_url', '/some-internal-path')
           ->save();
         $this->postSubmission($webform_confirmation_url);
    -    $assert_session->addressEquals('/some-absolute-path');
    +    $assert_session->addressEquals('/some-internal-path');

    That's a regression when /base-path is used. It must be $assert_session->addressEquals('/base-path/some-internal-path');

  • Status changed to Postponed: needs info over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    I will not touch this code unless something is broken in the webform module. If we make any more changes to the confirmation redirect URLs it will likely cause a regression for someone.

  • Status changed to Closed: won't fix about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY
Production build 0.69.0 2024