bbcode-to-react icon indicating copy to clipboard operation
bbcode-to-react copied to clipboard

Uncaught TypeError: Cannot read property '0' of undefined

Open TanninOne opened this issue 7 years ago • 1 comments

When parsing tags this code entirely relies on a parse result:

let params = this.parseParams(token.slice(1, -1));
let tagName = params[0][0].toLowerCase();

However parseParam will return an empty array for empty tags or tags that start with on, because of this

      if (name) {
        const n = name.trim();
        // ignore on* events attribute
        if (n.length && n.toLowerCase().indexOf('on') !== 0) {
          params.push([n, value]);
        }
      }

Now "[ ]" is used for example by github for an empty checkbox, [on...] could be all kind of things, both are valid and shouldn't cause the parser to throw an exception.

TanninOne avatar Sep 07 '18 09:09 TanninOne

Would be nice if this issue can be fixed

dainiusgliebus avatar Apr 18 '19 15:04 dainiusgliebus