publiccode-editor icon indicating copy to clipboard operation
publiccode-editor copied to clipboard

Expose verbose error on duplicate key in uploaded publiccode.yml

Open libremente opened this issue 5 years ago • 0 comments

Subject of the issue

When a publiccode.yml file containing at least one duplicated key is uploaded, the editor throws an error saying Parsing error.

Steps to reproduce

Upload a publiccode.yml containing a duplicate key.

Expected behaviour

The js-yaml library has 2 possible load functions: load and safeLoad. First of all, I believe we should switch to safeLoad since it's recommended when dealing with untrusted sources. Then, safeLoad raises an Exception which we should catch and, when possible, expose the relevant error. In this particular case, the error should not be generic but it should say Parsing error: duplicate key found or something like that.

Actual behaviour

A generic error is shown and it's not possible to continue.

libremente avatar May 28 '19 09:05 libremente