teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

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

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