10000 Parse unread messages count as integer before sending to host · getferdi/ferdi@7566ccd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 7566ccd

Browse files
committed
Parse unread messages count as integer before sending to host
This will correct errors that recipes may introduce, e.g. by sending a String instead of an integer (as seen on old versions of the ProtonMail recipe)
1 parent 81ae489 commit 7566ccd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/webview/lib/RecipeWebview.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ class RecipeWebview {
3939
if (this.countCache.direct === direct
4040
&& this.countCache.indirect === indirect) return;
4141

42+
// Parse number to integer
43+
// This will correct errors that recipes may introduce, e.g.
44+
// by sending a String instead of an integer
45+
const directInt = parseInt(direct);
46+
const indirectInt = parseInt(indirect);
47+
4248
const count = {
43-
direct: direct > 0 ? direct : 0,
44-
indirect: indirect > 0 ? indirect : 0,
49+
direct: directInt > 0 ? directInt : 0,
50+
indirect: indirectInt > 0 ? indirectInt : 0,
4551
};
4652

4753
ipcRenderer.sendToHost('messages', count);

0 commit comments

Comments
 (0)
0