favGifSearch: don't error on favourited non-urls (#2260)

This commit is contained in:
stupid cat 2024-03-13 17:23:04 -04:00 committed by GitHub
parent afdcf0edb9
commit f3ee43fe66
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,7 +200,14 @@ function SearchBar({ instance, SearchBarComponent }: { instance: Instance; Searc
export function getTargetString(urlStr: string) { export function getTargetString(urlStr: string) {
const url = new URL(urlStr); let url: URL;
try {
url = new URL(urlStr);
} catch (err) {
// Can't resolve URL, return as-is
return urlStr;
}
switch (settings.store.searchOption) { switch (settings.store.searchOption) {
case "url": case "url":
return url.href; return url.href;