url for media wrong: napcraft (missing s)

Bug #1908235 reported by Toto Bille on 2020-12-15
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
High
Daniel Manrique

Bug Description

the URL for medias is missing an S on staging. It's currently pointing to: https://api.staging.napcraft.io/

$ curl "https://api.staging.snapcraft.io/v2/charms/info/mattermost?fields=result.media" | jq
{
  "id": "HzikIBbgkFxKApYSwnS8n2dUYGLfMuXd",
  "name": "mattermost",
  "result": {
    "media": [
      {
        "height": null,
        "type": "icon",
        "url": "https://api.staging.napcraft.io/api/v1/media/download/charm_HzikIBbgkFxKApYSwnS8n2dUYGLfMuXd_icon__da58ad7ec5670e4564fc5218fba8db7bf0d9b05432247196b07b4900a71bea27.png",
        "width": null
      }
    ]
  },
  "type": "charm"
}

Daniel Manrique (roadmr) wrote :

Sorry! A typo snuck in the config file for the importer on staging, and from there made its way into the database.

I'll try rerunning the import with the fix in place, if that doesn't help I'll need to tweak the database.

Changed in snapstore-server:
assignee: nobody → Daniel Manrique (roadmr)
status: New → Triaged
importance: Undecided → High
Daniel Manrique (roadmr) wrote :

update snap set media=jsonb_set(media::jsonb, '{0, url}', to_jsonb(replace(media#>>'{0,url}','.napcraft.io', '.snapcraft.io'))) where package_type in ('charm', 'charm_bundle') and media#>>'{0,url}' like '%.napcraft.io%';

Changed in snapstore-server:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers