Upload icon returns KeyError: u'icon'

Bug #1792404 reported by Toto Bille
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
Fix Released
Undecided
Matias Bordese

Bug Description

API returns KeyError: u'icon' when uploading an non valid icon to a snap that already has an icon.
You can find the issue on sentry: https://sentry.ols.canonical.com/canonical/snapcraft-dashboard/issues/6064/

# Step to reproduce

- Have a snap with a existing icon
- Upload an image too big (example: https://www.bhphotovideo.com/images/images500x500/Rosco_102301642124_E_Colour_164_Flame_Red_163075.jpg)
- API returns: `{'error_list': [{'message': "KeyError: u'icon'", 'code': 'internal-server-error'}]}`

# Excpected behaviour

- Have a snap with a existing icon
- Upload an image too big (example: https://www.bhphotovideo.com/images/images500x500/Rosco_102301642124_E_Colour_164_Flame_Red_163075.jpg)
- API returns: `{'error_list': [{'message': 'Image must be exactly 256x256 pixels in size.', 'code': 'invalid-field', 'extra': {'field': 'icon', 'value': 'blue.png', 'size': 256}}]}`

Revision history for this message
Daniel Manrique (roadmr) wrote :

Hello,

When you "Upload an image too big", you're hitting this endpoint:

https://dashboard.snapcraft.io/dev/api/snaps/<your_snap_id>/binary-metadata

Could you perhaps somehow obtain the payload you're sending to this endpoint? I don't think I need the full binary parts for the actual icons, so if you want to elide that, that should be fine.

I tried your repro case and got the expected behavior, so something else is at play here.

Changed in snapstore:
status: New → Incomplete
Revision history for this message
Toto Bille (tbmb) wrote :

Here is the payload that I have send when I upload an image (of wrong size) for a snap that has already has an icon set:

{'info': '[{"key": "red (copy 1).png", "type": "icon", "filename": "red (copy 1).png", "hash": "73f1e44b8bdfdf921f4da13cba884043b835b48c88290097cda0c99fae8f580b"}]'}

Daniel Manrique (roadmr)
Changed in snapstore:
status: Incomplete → Confirmed
Matias Bordese (matiasb)
Changed in snapstore:
assignee: nobody → Matias Bordese (matiasb)
Matias Bordese (matiasb)
Changed in snapstore:
status: Confirmed → In Progress
Matias Bordese (matiasb)
Changed in snapstore:
status: In Progress → Fix Committed
Matias Bordese (matiasb)
Changed in snapstore:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.