italia / publiccode-editor

A web editor to create and edit publiccode.yml files
https://publiccode-editor.developers.italia.it
GNU Affero General Public License v3.0
20 stars 25 forks source link

Import failed when attributes have the wrong format #282

Open mueller-tobias opened 1 year ago

mueller-tobias commented 1 year ago

Hello,

we've the problem that some developers of our plattform create the publiccode.yaml manually. When the publicode.yaml hasn't the correct format, the editor will crash when the developer tries to upload the publicode.yaml for validation.

Steps to reproduce

Create a publiccode.yaml but use a string instead of a list on the description.en.feature attribute. The Editor will crash and not load anything

# This repository adheres to the publiccode.yml standard by including this
# metadata file that makes public software easily discoverable.
# More info at https://github.com/italia/publiccode.yml

publiccodeYmlVersion: "0.5"
name: Testapp
url: "https://gitlab.opencode.de/test/testapp"
releaseDate: "2023-07-01"
softwareVersion: "1.0"
platforms:
  - linux
categories:
  - data-analytics
  - data-visualization
developmentStatus: stable
softwareType: standalone/other
en:
  countryExtensionVersion: "0.2"
maintenance:
  type: community
  contacts:
    - name: Test
      email: Test@test.com
  contractors:
    - name: Test
      website: "https://www.test.com/"
legal:
  license: EUPL
  mainCopyrightOwner: ITDZ
  repoOwner: ITDZ
localisation:
  localisationReady: false
  availableLanguages:
    - en
description:
  en:
    genericName: DSGVO compliant test app
    shortDescription: DSGVO compliant test app description short
    longDescription: |

      DSGVO compliant test app description long
    features: "Test Feature"

When you can the line

features: "Test Feature"

to

features:
- "Test Feature"

Expected behaviour

Show the yaml file and mark the line/lines that throw the error. This would give the user a hint where the error in his file is.

Actual behaviour

The Editor crashs and show's nothing.

mueller-tobias commented 1 year ago

I think the real problem is the publiccode-parser. Should i open there an issue as well?

bfabio commented 1 year ago

@mueller-tobias thanks for the issue

I think the real problem is the publiccode-parser. Should i open there an issue as well?

If you managed to crash the parser with some wrong input, please do