- Issue was unassigned.
- Merge request !122Issue #2974809 by Anonymous, agentrickard: Query parameters like _format in... β (Open) created by vhin0210
We have an endpoint that specifies ?_format=json since it is a View that needs to be displayed as JSON. See the following: https://www.drupal.org/node/2954953 β
It looks like this:
/en-ca/service/locations/area?_format=json
In the latest alpha, the Domain Source module's outbound path processor is assuming too much, or there's a bug. Not sure which.
The error received on this endpoint, instead of returning the correct JSON, shows:
{"message":"No route found for the specified format html."}
Basically the $options['query'] is blank. However if you fill it in, it still causes the error at this line:
$url = Url::fromUserInput($alias, $options);
The quick solution is to do something like this before we grab the URL. I don't know if this is a good one for all cases, but since query params aren't being done correctly in this outbound processor when building the URL it's the only thing I can think that works:
// The _format query parameter causes issues when building the URL from user
// input, so just return the path before doing other processing.
if (is_object($request) && $request->query != NULL) {
$query_params = $request->query->all();
if (!empty($query_params) && isset($query_params['_format'])) {
return $path;
}
}
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.