Skip to content

Commit

Permalink
fix: update default search engine to google search (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
viphan007 authored Dec 2, 2024
1 parent ce2459a commit 81ae19d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/Autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Autocomplete extends Component {
handleSubmit = (event) => {
event.preventDefault();
this.trackEventSearchUsed();
const searchEngine = window.__mmSearchEngine || 'DuckDuckGo';
const searchEngine = window.__mmSearchEngine;
const sanitizedInput = onUrlSubmit(this.state.value, searchEngine);
window.location.href = sanitizedInput;
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import URL from 'url-parse';
* @param {string} defaultProtocol - Protocol string to append to URLs that have none
* @returns {string} - String corresponding to sanitized input depending if it's a search or url
*/
export default function onUrlSubmit(input, searchEngine = 'DuckDuckGo', defaultProtocol = 'https://') {
export default function onUrlSubmit(input, searchEngine, defaultProtocol = 'https://') {
//Check if it's a url or a keyword
const res = input.match(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!&',;=.+]+$/g);
if (res === null) {
Expand Down

0 comments on commit 81ae19d

Please sign in to comment.