grafana / plugin-validator

Tool for validating Grafana community plugins
Apache License 2.0
24 stars 8 forks source link

Validate screenshot mime types #277

Open xnyo opened 6 days ago

xnyo commented 6 days ago

The screenshots validator (here) should be updated to include a check of the mime type of the screenshots included in the zip file. Currently, it only checks if the files exist.

GCOM validates the screenshots mime types when publishing a plugin. An invalid or unsupported mime type will cause the following error:

{
  "code": "InvalidArgument",
  "message": "Image is of unsupported type.",
  "requestId": "d3438a80-ea2c-49c1-94f9-ebea30afcad2"
}

Valid mime types are defined here:

https://github.com/grafana/grafana-com/blob/b45bb5f67d851018a0a3208720cc3fd5240edbf3/packages/grafana-com-lib-api/src/images/validation.ts#L105

The validator should check that the screenshots are supported by GCOM, or it will reject the plugin upon attempting to publish it.