Fix: dont force lowercase URL in QuickLaunch (#3634)

pull/3642/head
shamoon 5 months ago committed by GitHub
parent ef154b348e
commit 5d6e202840
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -69,16 +69,18 @@ export default function QuickLaunch({ servicesAndBookmarks, searchString, setSea
}, [close, setSearchString, setCurrentItemIndex, setSearchSuggestions]); }, [close, setSearchString, setCurrentItemIndex, setSearchSuggestions]);
function handleSearchChange(event) { function handleSearchChange(event) {
const rawSearchString = event.target.value.toLowerCase(); const rawSearchString = event.target.value;
try { try {
if (!/.+[.:].+/g.test(rawSearchString)) throw new Error(); // basic test for probably a url if (!/.+[.:].+/g.test(rawSearchString)) throw new Error(); // basic test for probably a url
let urlString = rawSearchString; let urlString = rawSearchString;
if (urlString.indexOf("http") !== 0) urlString = `https://${rawSearchString}`; if (urlString.toLowerCase().indexOf("http") !== 0) urlString = `https://${rawSearchString}`;
setUrl(new URL(urlString)); // basic validation setUrl(new URL(urlString)); // basic validation
setSearchString(rawSearchString);
return;
} catch (e) { } catch (e) {
setUrl(null); setUrl(null);
} }
setSearchString(rawSearchString); setSearchString(rawSearchString.toLowerCase());
} }
function handleSearchKeyDown(event) { function handleSearchKeyDown(event) {

Loading…
Cancel
Save