Skip to content

Commit 009199c

Browse files
authored
DYN-5194 add http protocol to notification link in case it is missing (#47)
* add http protocol to notification link in case it is missing * refactor: notification url protocol validation
1 parent b5ce482 commit 009199c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ function App() {
3131
}
3232
},[]);
3333

34+
const validateNotificationUrl = (url) => !url.startsWith("https://") ? `https://${url}` : url;
35+
3436
const setPopupHeight = () => {
3537
if(chrome.webview === undefined) return;
3638
chrome.webview.hostObjects.scriptObject.UpdateNotificationWindowSize(document.body.scrollHeight);
@@ -70,7 +72,7 @@ function App() {
7072
content: <div>
7173
<b>{notifications[i].title}</b>
7274
<p>{notifications[i].longDescription}</p>
73-
<a href={notifications[i].link} target="_blank" rel="noreferrer">{notifications[i].linkTitle}</a>
75+
<a href={validateNotificationUrl(notifications[i].link)} target="_blank" rel="noreferrer">{notifications[i].linkTitle}</a>
7476
</div>
7577
};
7678
notificationsData.push(notificationItem);

0 commit comments

Comments
 (0)