favGifSearch: don't error on favourited non-urls (#2260)
This commit is contained in:
parent
afdcf0edb9
commit
f3ee43fe66
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue