fix: prevent double encode if we are on /search endpoint (#3238)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { encodeURIExtraParams } from '@app/hooks/useSearchInput';
|
||||
import { MediaStatus } from '@server/constants/media';
|
||||
import useSWRInfinite from 'swr/infinite';
|
||||
import useSettings from './useSettings';
|
||||
@@ -28,6 +27,23 @@ interface DiscoverResult<T, S> {
|
||||
firstResultData?: BaseSearchResult<T> & S;
|
||||
}
|
||||
|
||||
const extraEncodes: [RegExp, string][] = [
|
||||
[/\(/g, '%28'],
|
||||
[/\)/g, '%29'],
|
||||
[/!/g, '%21'],
|
||||
[/\*/g, '%2A'],
|
||||
];
|
||||
|
||||
export const encodeURIExtraParams = (string: string): string => {
|
||||
let finalString = encodeURIComponent(string);
|
||||
|
||||
extraEncodes.forEach((encode) => {
|
||||
finalString = finalString.replace(encode[0], encode[1]);
|
||||
});
|
||||
|
||||
return finalString;
|
||||
};
|
||||
|
||||
const useDiscover = <
|
||||
T extends BaseMedia,
|
||||
S = Record<string, never>,
|
||||
|
||||
Reference in New Issue
Block a user