MarketPlace Api Submission manifest Validate 500 error

RESOLVED FIXED in 2013-09-17

Status

Marketplace
API
P2
normal
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: ecritian, Assigned: ashort)

Tracking

2013-09-17
Points:
---

Details

(Whiteboard: [qa-])

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
Created attachment 796356 [details]
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
(Assignee)

Updated

5 years ago
Priority: -- → P2
(Assignee)

Comment 2

5 years ago
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
Last Resolved: 5 years ago
Resolution: --- → INVALID
(Reporter)

Comment 3

5 years ago
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.
(Reporter)

Comment 4

5 years ago
I'm using test chrome-rest-app "RestClient"

and coffiescript test

Both failed
(Reporter)

Comment 5

5 years ago
Created attachment 802761 [details]
screenshot
(Reporter)

Updated

5 years ago
Attachment #802761 - Attachment description: 스크린샷 2013-09-11 오전 11.53.20.png → screenshot
Attachment #802761 - Attachment filename: 스크린샷 2013-09-11 오전 11.53.20.png → screenshot
(Assignee)

Comment 6

5 years ago
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.)
(Assignee)

Comment 7

5 years ago
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
(Assignee)

Updated

5 years ago
Target Milestone: --- → 2013-09-17

Comment 8

5 years ago
Can you please add some STRs to this bug or mark it as [qa-] ?
(Assignee)

Updated

5 years ago
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.