teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0790-journal-gateway-use-localStorage-cursor-only-when-it.patch

661545
From 0b53945e8b1db6255bf25017a7569b2545c8ed15 Mon Sep 17 00:00:00 2001
661545
From: Yu Watanabe <watanabe.yu+github@gmail.com>
661545
Date: Wed, 27 Jun 2018 14:50:19 +0900
661545
Subject: [PATCH] journal-gateway: use localStorage["cursor"] only when it has
661545
 valid value
661545
661545
Discovered by LGTM.
661545
661545
(cherry picked from commit 944072feddb73333023d0a98bf87fd2a17f894d3)
661545
661545
Resolves: #1694605
661545
---
661545
 src/journal-remote/browse.html | 10 ++++++----
661545
 1 file changed, 6 insertions(+), 4 deletions(-)
661545
661545
diff --git a/src/journal-remote/browse.html b/src/journal-remote/browse.html
661545
index 30615795b3..be1ec5f235 100644
661545
--- a/src/journal-remote/browse.html
661545
+++ b/src/journal-remote/browse.html
661545
@@ -236,10 +236,12 @@
661545
 
661545
                 function entriesLoad(range) {
661545
 
661545
-                        if (range == null)
661545
-                                range = localStorage["cursor"] + ":0";
661545
-                        if (range == null)
661545
-                                range = "";
661545
+                        if (range == null) {
661545
+                                if (localStorage["cursor"] != null && localStorage["cursor"] != "")
661545
+                                        range = localStorage["cursor"] + ":0";
661545
+                                else
661545
+                                        range = "";
661545
+                        }
661545
 
661545
                         var url = "/entries";
661545