Closed Bug 910008 Opened 11 years ago Closed 11 years ago

MarketPlace Api Submission manifest Validate 500 error

Categories

(Marketplace Graveyard :: API, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
2013-09-17

People

(Reporter: ecritian, Assigned: ashort)

Details

(Whiteboard: [qa-])

Attachments

(2 files)

Attached image validation500error.png
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36

Steps to reproduce:

manifest validation using api


Actual results:

500 error
Assignee: nobody → robhudson.mozbugs
diff --git a/mkt/site/middleware.py b/mkt/site/middleware.py
index afe6ae6..6d2936c 100644
--- a/mkt/site/middleware.py
+++ b/mkt/site/middleware.py
@@ -229,7 +229,7 @@ class RestrictJSONUploadSizeMiddleware(object):
     def process_view(self, request, view_func, args, kwargs):
         if not kwargs == {'api_name': 'apps', 'resource_name': 'validation'}:
             return
-        if (int(request.META.get('CONTENT_LENGTH', 0)) >
+        if (int(request.META.get('CONTENT_LENGTH', 0) or 0) >
             mkt.constants.MAX_PACKAGED_APP_SIZE):
             response = http.HttpResponse()
             response.status_code = 413

That patch fixes the problem for me locally, but I'm hesitant to commit that because CONTENT_LENGTH shouldn't be an empty string, which is what is causing this to 500.

Allen, can you investigate why empty string is getting this far?
Assignee: robhudson.mozbugs → ashort
Priority: -- → P2
I don't believe this patch changes anything; notice the body of the response in the screenshot. The request has a content type of application/json but no Content-Length and no body, and is thus rejected as invalid JSON.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Thank you
However, when http://affiwtaoe.github.io/mainfest.webapp check the file contents of the file exists and
also https://marketplace.firefox.com/developers/submit/ validate pass

I don't know why a failure to read the contents of the file. Clear header application / json was tested by selecting.
I'm using test chrome-rest-app "RestClient"

and coffiescript test

Both failed
Attached image screenshot
Attachment #802761 - Attachment description: 스크린샷 2013-09-11 오전 11.53.20.png → screenshot
Attachment #802761 - Attachment filename: 스크린샷 2013-09-11 오전 11.53.20.png → screenshot
The problem is that you're trying to pass the manifest as a query arg; all arguments to Marketplace APIs are passed as JSON, so you need to send {"manifest": "http://affiwtaoe.github.io/manifest.webapp"} as the body of your POST.

(And upon further review, I do see the problem Rob mentioned. Content-Length is an empty string when the header is not present.)
https://github.com/mozilla/zamboni/commit/60a0a87

WSGI spec says CONTENT_LENGTH "may be empty or absent", so this is a reasonable way to deal with it.
Resolution: INVALID → FIXED
Target Milestone: --- → 2013-09-17
Can you please add some STRs to this bug or mark it as [qa-] ?
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: