angular-local-storage icon indicating copy to clipboard operation
angular-local-storage copied to clipboard

addToLocalStorage should not fallback to cookies on exception

Open eltoder opened this issue 7 years ago • 0 comments
trafficstars

Currently addToLocalStorage() catches exceptions from webStorage.setItem() and falls back to writing to cookies if an exception happened (code). This seems wrong:

  • It doesn't check self.defaultToCookie before doing so.
  • Since browserSupportsLocalStorage is true, there's no matching code in getFromLocalStorage() to read the saved value.

In practice this leads to the following problem: if the local storage limit is exceeded, the data starts being written to cookies, which quickly overflows the cookie size limits and causes 400.

eltoder avatar Feb 23 '18 19:02 eltoder