Closed Bug 1153669 Opened 11 years ago Closed 11 years ago

Upload of App Icon through Marketplace API fails silently

Categories

(Marketplace Graveyard :: Developer Pages, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED
2015-04-28

People

(Reporter: richard.brammer, Assigned: mat)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 Steps to reproduce: I try to update the Firefox Marketplace entry of an app programatically via the Python API. I am able to successfully upload screenshots using the client.create_screenshot(app_id, filename) method from the module marketplace against the development environment at https://marketplace-dev.allizom.org/. Within the Python API there is no method to upload the Icon. In the Marketplace API documentation though, there is a REST point to upload the icon: Updating an App Icon I used the documentation to write my own method to upload the icon: import mimetypes import sys from base64 import b64encode from urlparse import urlunparse def post_icon_file(client, app_id, filename): with open(filename, 'rb') as s_file: s_content = s_file.read() s_encoded = b64encode(s_content) url = urlunparse((client.protocol, '%s:%s' % (client.domain, client.port), '%s/api/v2%s' % (client.prefix, '/apps/app/' + str(app_id) + '/icon/'), '', '', '')) print url mtype, encoding = mimetypes.guess_type(filename) if mtype is None: mtype = 'image/jpeg' data = {'file': { 'type': mtype, 'data': s_encoded }} response = client.conn.fetch('PUT', url, data) if response.status_code != 200: sys.exit(response.content) else: print str(response.status_code) + ': Uploaded icon ' + filename + ' for app ID ' + str(app_id) I tried to upload an icon in the size of 128 by 128 pixels and another one in 512 by 512 pixels. Both have the same result: success, but they are not changed in the entry. Actual results: The response of the upload is a success (200). I get the message: 200: Uploaded icon /path/to/icon/icon-512.png for app ID 1234567 Still in the Marketplace entry at https://marketplace-dev.allizom.org/developers/app/[slug]/edit, the App Icon is shown as the default icon Expected results: On the Marketplace entry of the app (https://marketplace-dev.allizom.org/developers/app/[slug]/edit) the uploaded icon should be visible.
I tried to reproduce the error on a local development environment using the docker workflow. I can't reproduce the bug here – the icon apperas as expected on http://mp.dev/developers/app/[_SLUG_]/edit. But on https://marketplace-dev.allizom.org/developers/app/[_SLUG_]/edit the Icon is still missing after upload via the API.
Assignee: nobody → mpillard
Priority: -- → P3
I had a look at marketplace-dev; the db entry for this screenshot exists but the file does not.
Status: UNCONFIRMED → NEW
Ever confirmed: true
It's working fine for me: % DATA=$( base64 -w 0 ~/Pictures/icon2.png ) % curling -X PUT -d '@-' https://marketplace-dev.allizom.org/api/v2/apps/app/test-app-updateme/icon/ << CURL_DATA {"upload": {"type": "image/png", "name": "icon.png", "data": "$DATA"}} CURL_DATA I see the updated icon in my (non-public) app. I suspect a temporary issue on -dev...
This may be an issue with the fetch/resize icon/previews task being called too late, before the transaction has been committed. I've submitted https://github.com/mozilla/zamboni/pull/3047 to solve this.
Status: NEW → ASSIGNED
Should be fixed in https://github.com/mozilla/zamboni/commit/915afbfc6f43236ed5b911dee0618d0f7e9ab981 If I'm right this didn't affect just the API, so I'm changing the component. Please test on -dev with a new app and re-open if it still doesn't work. QA: - Submit an app - Check that the icon and preview were added correctly - Change the icon and previews in edit listing page - Check that the icon and preview were updated correctly
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Component: API → Developer Pages
Resolution: --- → FIXED
Target Milestone: --- → 2015-04-28
After changing the icon in edit listing page , the waiting spinner and "Image changes being processed" message are continuously displayed : http://screencast.com/t/qPqJIGdps
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
That was a temporary issue on dev, it should be ok now.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.