lz-string icon indicating copy to clipboard operation
lz-string copied to clipboard

LZString throws w is undefined exception

Open SISheogorath opened this issue 7 years ago • 1 comments

We got some, not so nice, error messages out of LZString.

018-02-16T14:03:22.222Z - error:  TypeError: Cannot read property 'charAt' of undefined
at Object._decompress (/hackmd/node_modules/lz-string/libs/lz-string.js:473:24)
at Object.decompressFromBase64 (/hackmd/node_modules/lz-string/libs/lz-string.js:44:21)

Result:

LZString throws an `Cannot read property `charAt` of undefined

Expected result:

LZString returns an empty string as it usually does in case of invalid base64 strings.

Steps to reproduce:

  1. Load LZString
  2. Call LZString.decompressFromBase64("zadachi")

As comparsion:

  1. Load LZString
  2. Call LZString.decompressFromBase64("asdf")

SISheogorath avatar Feb 17 '18 17:02 SISheogorath

Related https://github.com/hackmdio/hackmd/issues/727

SISheogorath avatar Feb 17 '18 19:02 SISheogorath