Skip to content

Commit

Permalink
Avoid HTTP 400 error when fetch "extra" information for Wikipedia pag…
Browse files Browse the repository at this point in the history
…e and search term includes diacritics
  • Loading branch information
collectiveaccess committed Oct 26, 2024
1 parent b2e48b5 commit 0dc8e52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/helpers/utilityHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3382,8 +3382,8 @@ function caQueryExternalWebservice($ps_url) {

$vs_content = curl_exec($vo_curl);

if(curl_getinfo($vo_curl, CURLINFO_HTTP_CODE) !== 200) {
throw new WebServiceError(_t('An error occurred while querying an external webservice'). _t(" at %1", $ps_url). " ". print_r(curl_getinfo($vo_curl), true));
if(($code = curl_getinfo($vo_curl, CURLINFO_HTTP_CODE)) !== 200) {
throw new WebServiceError(_t('An error occurred while querying an external webservice'). _t(" at %1 [HTTP code was %2]", $ps_url, $code). " ". print_r(curl_getinfo($vo_curl), true));
}
curl_close($vo_curl);
return $vs_content;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/Plugins/InformationService/Wikipedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function getExtraInfo($pa_settings, $ps_url) {
// readable version of get parameters
$va_get_params = array(
'action' => 'query',
'titles' => self::getPageTitleFromURI($ps_url),
'titles' => urlencode(self::getPageTitleFromURI($ps_url)),
'prop' => 'pageimages|info|extracts',
'inprop' => 'url',
'piprop' => 'name|thumbnail',
Expand Down

0 comments on commit 0dc8e52

Please sign in to comment.