Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<image> URI validation #173

Closed
hsitter opened this issue Jan 31, 2018 · 7 comments
Closed

<image> URI validation #173

hsitter opened this issue Jan 31, 2018 · 7 comments

Comments

@hsitter
Copy link
Contributor

hsitter commented Jan 31, 2018

appstreamcli validate apparently doesn't validate that are actually valid URIs

e.g. I recently saw an app dev forget to deal with a bit of boilerplate placeholder and leave the following in their appdata:

      <image>
        see https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-screenshots
        Central hosting for uploading at https://phabricator.kde.org/source/websites-product-screenshots/
        Central URL to use here https://cdn.kde.org/screenshots/...
      </image>

Would be handy if it ran the image through a URI parser.

@ximion
Copy link
Owner

ximion commented Jan 31, 2018

This is actually implemented, unless you pass the --nonet flag to appstreamcli.
The only improvement I can imagine here would be to validate whether we have an URL at all even if nonet has been passed.

@hsitter
Copy link
Contributor Author

hsitter commented Jan 31, 2018

That's without any flags appstreamcli validate org.kde.babe.appdata.xml

I've asked some people to test on newer versions but haven't heard back yet. On the 0.11.1 cli we have in neon the <image> did not cause a validation error.

I am posting the complete appdata so everyone can give it a try

<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
  <id>org.kde.babe.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>GPL-3.0</project_license>
  <name>Babe</name>
  <summary>Babe is a tiny music collection manager</summary>
  <description>
    <p> Babe will handle your whole music collection, letting you create custom playlists to organize your music. You can also filter your music by artist, title, album, genre, date and location. Babe let's you babe-mark your favorite YouTube music videos into your local collection by using the Chromium extension. Think of Babe as the playlist where all your favorite tracks at the moment are. And when needed you also have an integrated collection manager. </p>
    <p>Use the Chrome extension to collect your favorite music videos from online streaming services like YouTube or Vimeo. Babe uses youtube-dl, so all the supported sites by it are also supported by Babe</p>
    <p>Babe is built with a tight integration with the Plasma desktop, making use of native notifications, mpris controls, kde connect to send your music to your devices and also krunner action queries.</p>
    <ul>
      <li>this</li>
      <li>that</li>
    </ul>
  </description>
  <url type="homepage">https://babe.kde.org/</url>
  <url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&amp;product=babe</url>
  <url type="donation">https://www.kde.org/community/donations/?app=Babe</url>
  <screenshots>
    <screenshot type="default">
      <image>
        see https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-screenshots
        Central hosting for uploading at https://phabricator.kde.org/source/websites-product-screenshots/
        Central URL to use here https://cdn.kde.org/screenshots/...
      </image>
    </screenshot>
  </screenshots>
  <provides>
    <binary>babe</binary>
  </provides>
  <project_group>KDE</project_group>
</component>

@ximion
Copy link
Owner

ximion commented Jan 31, 2018

@apachelogger You will need at least AppStream 0.11.7 to get URL testing working by default.

@hsitter
Copy link
Contributor Author

hsitter commented Jan 31, 2018

Ah!
If the appdata doesn't pass validation with 0.11.7 I'm fine with closing the issue, sorry for the noise :)

@ximion
Copy link
Owner

ximion commented Jan 31, 2018

Validation with 0.11.8:

P - org.kde.babe.xml:org.kde.babe.desktop:21
    The screenshot does not have a caption text.

W - org.kde.babe.xml:org.kde.babe.desktop:22
    Unable to reach screenshot image on remote location '
            see 
    https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-screenshots
            Central hosting for uploading at 
    https://phabricator.kde.org/source/websites-product-screenshots/
            Central URL to use here https://cdn.kde.org/screenshots/...
          ' - does the image exist?

Validation failed: warnings: 1, pedantic: 1

@hsitter
Copy link
Contributor Author

hsitter commented Jan 31, 2018

Yay. Cheers!

@hsitter hsitter closed this as completed Jan 31, 2018
@ximion
Copy link
Owner

ximion commented Jan 31, 2018

I might add a regex-based validation as well though, at a later time :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants