fix(search): Handle search errors and escape * (#893)

This commit is contained in:
Jakob Ankarhem
2021-02-10 00:29:35 +01:00
committed by GitHub
parent 7e906e2d46
commit 034968e437
2 changed files with 3 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import { LanguageContext } from '../../context/LanguageContext';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import Header from '../Common/Header'; import Header from '../Common/Header';
import PageTitle from '../Common/PageTitle'; import PageTitle from '../Common/PageTitle';
import Error from '../../pages/_error';
const messages = defineMessages({ const messages = defineMessages({
search: 'Search', search: 'Search',
@@ -53,7 +54,7 @@ const Search: React.FC = () => {
}; };
if (error) { if (error) {
return <div>{error}</div>; return <Error statusCode={error.code} />;
} }
const titles = data?.reduce( const titles = data?.reduce(

View File

@@ -11,6 +11,7 @@ const extraEncodes: [RegExp, string][] = [
[/\(/g, '%28'], [/\(/g, '%28'],
[/\)/g, '%29'], [/\)/g, '%29'],
[/!/g, '%21'], [/!/g, '%21'],
[/\*/g, '%2A'],
]; ];
const encodeURIExtraParams = (string: string): string => { const encodeURIExtraParams = (string: string): string => {