File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public function get($handle)
3737
3838 public function findByUrl ($ url )
3939 {
40+ $ url = Str::before ($ url , '? ' );
4041 $ url = Str::ensureRight ($ url , '/ ' );
4142
4243 return collect ($ this ->sites )->filter (function ($ site ) use ($ url ) {
Original file line number Diff line number Diff line change @@ -122,6 +122,11 @@ public function gets_site_from_url()
122122 // https://github.com/statamic/cms/issues/1874
123123 $ this ->assertEquals ('en ' , $ this ->sites ->findByUrl ('http://test.com/delightful ' )->handle ());
124124 $ this ->assertEquals ('de ' , $ this ->sites ->findByUrl ('http://test.com/de ' )->handle ());
125+
126+ // Make sure that urls that have a query string don't get misinterpreted.
127+ // https://github.com/statamic/cms/issues/2207
128+ $ this ->assertEquals ('en ' , $ this ->sites ->findByUrl ('http://test.com?foo=bar ' )->handle ());
129+ $ this ->assertEquals ('de ' , $ this ->sites ->findByUrl ('http://test.com/de?foo=bar ' )->handle ());
125130 }
126131
127132 /** @test */
You can’t perform that action at this time.
0 commit comments