Problem/Motivation

How to reproduce:
* Go to admin/config/system/site-information
* Into "Default front page" enter a path with querystring, e.g. "/admin/people?status=2"
* Submit
* Go to Frontpage

Expected: See the configured page (here users filtered by "blocked")

Result: "Page not found"

Proposed resolution

Fix this.

Remaining tasks

Codeit.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB

Patch flying in that worksforme.

vj’s picture

@axel.rutz Yeah patch works, Just a thought what if fragment added then this patch not works.

geek-merlin’s picture

StatusFileSize
new1.46 KB

> what if fragment added then this patch not works.

Good point! Improved patch flying in.

geek-merlin’s picture

StatusFileSize
new1.19 KB

Also removed now obsolete use statement.

geek-merlin’s picture

StatusFileSize
new1.27 KB

Ups, got the array_replace the wrong way round.

dawehner’s picture

StatusFileSize
new1.75 KB

Here is a test for this fix.

Status: Needs review » Needs work

The last submitted patch, 7: 3000671-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

msankhala’s picture

Status: Needs work » Needs review
StatusFileSize
new2.65 KB

Here is a patch with fix and test from #6 and #7 including minor fix.

goodboy’s picture

+      $components = parse_url($path);
+      $query = $request->query->all();
+      // Remove querystring and fragment.
+      $path = $components['path'];
+      // Merge frontpae query to URL query, so actual URL takes precedence..
+      if (!empty($components['query'])) {
+        parse_str($components['query'], $parameters);
+        array_replace($parameters, $request->query->all());
+        $request->query->replace($parameters);
+      }
  1. Looks like $query = $request->query->all(); is not used
  2. "// Merge frontpae query to URL query, so actual URL takes precedence.." - grammatical errors
msankhala’s picture

StatusFileSize
new2.61 KB
new942 bytes

@goodboy Thanks for the review. Here is the updated patch.

surbz’s picture

StatusFileSize
new2.62 KB
new810 bytes

Thanks @goodboy for the review.
Thanks @msankhala for the patch, I tested it out your patch applies cleanly and works well just correcting the minor grammatical error and uploading the new patch along with interdiff

msankhala’s picture

This new patch is making the comment to exceed 80 characters.

surbz’s picture

StatusFileSize
new2.66 KB
new1.6 KB

Thanks @msankhala for noticing that, this reminds me to notice coding standard errors in 'PathProcessorFrontTest.php' as well.
Correcting both and uploading the new patch.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This looks great and has test-coverage. RTBC.

catch’s picture

+++ b/core/lib/Drupal/Core/PathProcessor/PathProcessorFront.php
@@ -42,6 +42,16 @@ public function processInbound($path, Request $request) {
+      $path = $components['path'];
+      // Merge frontpage query to URL query, so that actual URL takes
+      // precedence.
+      if (!empty($components['query'])) {
+        parse_str($components['query'], $parameters);
+        array_replace($parameters, $request->query->all());
+        $request->query->replace($parameters);
+      }
     }

I'm not entirely sure why we need to merge the query parameters, and 'merge frontpage query to URL query' isn't grammatically correct - it should be 'with' instead of 'to', but what is the front page query?

catch’s picture

Status: Reviewed & tested by the community » Needs work
goodboy’s picture

StatusFileSize
new870 bytes
new2.69 KB

Change this comment as I understood.

voleger’s picture

Status: Needs work » Reviewed & tested by the community

#18 addressed #16

  • catch committed 920eb06 on 8.7.x
    Issue #3000671 by axel.rutz, surbz, msankhala, goodboy, dawehner:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

OK that's much better.

Committed 920eb06 and pushed to 8.7.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.