A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
validate url is correct before opening to prevent crash
ammarahm-ed62aca5e33f86
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js b/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.jsindex de299ed1f..c3d12a60b 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/linkpreview.js@@ -9,6 +9,9 @@ import {useTracked} from '../../../../provider';import {openLinkInBrowser} from '../../../../utils/functions';import {SIZE} from '../../../../utils/SizeUtils';import {INPUT_MODE, properties, reFocusEditor} from './constants';+import validator from 'validator';+import { ToastEvent } from '../../../../services/EventManager';+let prevLink = {};const LinkPreview = ({setMode, value, onSubmit}) => {@@ -88,12 +91,21 @@ const LinkPreview = ({setMode, value, onSubmit}) => {};const openLink = () => {- openLinkInBrowser(value, colors)- .catch(e => {})- .then(async r => {- console.log('closed browser now');- await reFocusEditor();++ if (validator.isURL(value)) {+ openLinkInBrowser(value, colors)+ .catch(e => {})+ .then(async r => {+ console.log('closed browser now');+ await reFocusEditor();+ });+ } else {+ ToastEvent.show({+ heading:"Url not valid",+ message:value,+ type:'error'});+ }};const renderText = (name, title, description) => {