Closed Bug 637929 Opened 13 years ago Closed 13 years ago

uploading an image causes a UnicodeDecodeError

Categories

(addons.mozilla.org Graveyard :: Add-on Builder, defect, P1)

defect

Tracking

(Not tracked)

VERIFIED FIXED
Builder 0.9

People

(Reporter: smcarthur, Assigned: smcarthur)

Details

(Whiteboard: [ftw])

Traceback (most recent call last):

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/lib/python/django/core/handlers/base.py", line 106, in get_response
    response = middleware_method(request, e)

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/src/commonware/commonware/middleware.py", line 69, in process_exception
    request.POST = request.POST.copy()

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/lib/python/django/core/handlers/wsgi.py", line 171, in _get_post
    self._load_post_and_files()

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/lib/python/django/core/handlers/wsgi.py", line 137, in _load_post_and_files
    self._post, self._files = self.parse_file_upload(self.META, self.environ['wsgi.input'])

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/lib/python/django/http/__init__.py", line 123, in parse_file_upload
    parser = MultiPartParser(META, post_data, self.upload_handlers, self.encoding)

  File "/data/amo_python/www/builder.preview/flightdeck/vendor/lib/python/django/http/multipartparser.py", line 65, in __init__
    raise MultiPartParserError('Invalid boundary in multipart: %s' % boundary)

MultiPartParserError: Invalid boundary in multipart: None
Assignee: nobody → smcarthur
Priority: -- → P1
Whiteboard: [ftw]
Target Milestone: --- → Builder 0.9
This is a utf issue
We've got a problem as the "code" attachments should use utf-8 and binary attachments should be saved with 'wb' mode without codec
Summary: uploading an image causes a MultiPartParserError → uploading an image causes a UnicodeDecodeError
So, we set encoding to utf-8 if the file is_editable, otherwise leave it be to write as a binary file.

https://github.com/mozilla/FlightDeck/commit/c9f3bea6195ef6874eaad0e3508cf533e214d8f0
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.