Closed Bug 913434 Opened 11 years ago Closed 11 years ago

[traceback] UnicodeEncodeError: 'ascii' codec can't encode character u'\u200c' in position 1: ordinal not in range - mkt.carriers.middleware

Categories

(Marketplace Graveyard :: General, defect, P4)

defect

Tracking

(Not tracked)

VERIFIED FIXED
2013-09-24

People

(Reporter: mat, Assigned: cvan)

Details

http://sentry.mktmon.services.phx1.mozilla.com/mkt/marketplacefirefoxcom/group/1201/

UnicodeEncodeError: 'ascii' codec can't encode character u'\u200c' in position 1: ordinal not in range(128)

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 89, in get_response
    response = middleware_method(request)
  File "mkt/carriers/middleware.py", line 56, in process_request
    return redirect(urlparams(new_path, carrier=carrier))
  File "django/shortcuts/__init__.py", line 75, in redirect
    return redirect_class(urlresolvers.reverse(to, args=args, kwargs=kwargs))
  File "amo/urlresolvers.py", line 62, in reverse
    url = django_reverse(viewname, urlconf, args, kwargs, prefix, current_app)
  File "django/core/urlresolvers.py", line 476, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "django/core/urlresolvers.py", line 360, in _reverse_with_prefix
    lookup_view = get_callable(lookup_view, True)
  File "django/utils/functional.py", line 27, in wrapper
    result = func(*args)
  File "django/core/urlresolvers.py", line 92, in get_callable
    lookup_view = getattr(import_module(mod_name), func_name)
  File "django/utils/importlib.py", line 35, in import_module
    __import__(name)


Relevant code:

        if carrier and is_legacy:
            orig_path = request.path_info
            new_path = orig_path[len(carrier) + 1:] or '/'
            return redirect(urlparams(new_path, carrier=carrier))


I guess just doing new_path.encode('utf-8') would fix it. I don't think the error happens with real users, it's just script kiddies or whatever trying to find vulnerabilities (the URL here is https://marketplace.firefox.com/telefonica/%E2%80%8C.htaccess ) but we should fix it anyway, 500ing is bad.
Assignee: nobody → cvan
Target Milestone: --- → 2013-09-17
https://github.com/mozilla/zamboni/commit/d23a11c
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: 2013-09-17 → 2013-09-24
verified fixed at https://marketplace-dev.allizom.org/telefonica/%E2%80%8C.htaccess

[16:38:28.248] GET https://marketplace-dev.allizom.org/telefonica/%E2%80%8C.htaccess [HTTP/1.1 404 NOT FOUND 185ms]
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.