jmuehlner commented on code in PR #778:
URL: https://github.com/apache/guacamole-client/pull/778#discussion_r1035340052


##########
guacamole/src/main/frontend/src/app/storage/services/localStorageService.js:
##########
@@ -119,10 +122,18 @@ angular.module('storage').provider('localStorageService', 
[function localStorage
         }
         catch (ignore) {}
 
-        // Pull and parse value from internal storage, if present
+        // Pull from internal storage, if present
         var data = storedItems[key];
-        if (data)
-            return JSON.parse(data);
+        if (data) {
+
+            // Serialize to JSON if possible
+            try {
+                return JSON.stringify(value);
+            } catch (ignore) {}

Review Comment:
   A raw string isn't a valid JSON-parseable value, so that won't be quite so 
simple. I'll just make string-specific versions of these functions to clear up 
any ambiguity. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to