Problem/Motivation

When adding a redirect path with query parameters, a warning is shown when there already is a redirect for that path (with a different query)

Steps to reproduce

Add a redirect with source path: test?param=1
Add another redirect with source path: test?param=2
A warning is shown.

Proposed resolution

Improved warning showing the actual source paths that already exist.

User interface changes

Different warning message.

API changes

none

Data model changes

none

Issue fork redirect-3244296

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

SpadXIII created an issue. See original summary.

spadxiii’s picture

Status: Active » Needs review

paulocs made their first commit to this issue’s fork.

paulocs’s picture

I updated the MR. This issue makes sense to be merged for me.

gabrielda’s picture

Assigned: Unassigned » gabrielda

I will review this one

gabrielda’s picture

Assigned: gabrielda » Unassigned
Status: Needs review » Reviewed & tested by the community

It seems all good, moving to RTBC

kristen pol’s picture

Assigned: Unassigned » kristen pol

Assigning to myself as I'm triaging all RTBC issues.

kristen pol’s picture

Assigned: kristen pol » Unassigned
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

This needs a reroll as the test has changed.

Kristens-MacBook-Pro:redirect kristenpol$ patch -p1 < 13.diff 
patching file src/Plugin/Field/FieldWidget/RedirectSourceWidget.php
Hunk #1 succeeded at 5 (offset -1 lines).
Hunk #2 succeeded at 82 (offset -1 lines).
Hunk #3 succeeded at 99 (offset -1 lines).
patching file tests/src/FunctionalJavascript/RedirectJavascriptTest.php
Hunk #1 FAILED at 134.
1 out of 1 hunk FAILED -- saving rejects to file tests/src/FunctionalJavascript/RedirectJavascriptTest.php.rej

tests/src/FunctionalJavascript/RedirectJavascriptTest.php.rej

***************
*** 134,141 ****
      $this->assertSession()->assertWaitOnAjaxRequest();
      $this->assertRaw(
        t(
-         'The base source path %source is already being redirected. Do you want to <a href="@edit-page">edit the existing redirect</a>?',
-         ['%source' => 'non-existing?key=value', '@edit-page' => $redirect->toUrl('edit-form')->toString()]
        )
      );

--- 134,141 ----
      $this->assertSession()->assertWaitOnAjaxRequest();
      $this->assertRaw(
        t(
+         'A redirect for the path <a href="@edit-page" hreflang="und">/non-existing?key=value</a> already exists.',
+         ['@edit-page' => $redirect->toUrl('edit-form')->toString()]
        )
      );