Unicode non-ascii characters in channel specification cause a 500 response from the store
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snap Store Server |
New
|
Undecided
|
Unassigned | ||
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
snapcraft release hello-roadmr-
this results in a 500 response from the store with this traceback:
DataError: invalid byte sequence for encoding "UTF8": 0xed 0xb3 0xb0
File "piston/
result = meth(request, *args, **kwargs)
File "devportal/
return orig_func(self, request, *args, **kwargs)
File "devportal/
_channel = get_or_
File "devportal/
risk = Risk.objects.
File "django/
return getattr(
File "django/
num = len(clone)
File "django/
self.
File "django/
self.
File "django/
results = compiler.
File "django/
raise original_exception
information type: | Private → Public |
This seems to be an encoding issue related to terminal, click, snapcraft and store interaction: /pastebin. canonical. com/p/5BdCDTTGs f/
https:/
Specifically, store code is exploding when trying to deal with a string with surrogate escapes[1], that ideally snapcraft shouldn't be propagating to the server, handling the issue as soon as possible[2].
We could also validate store-side the given channels payload are ASCII-only values in the handler (although note that the real issue is there for any payload we get from clients including surrogate escapes). Note branch name validation is already done at the model level, this is failing in an intermediate step while inferring risk/branch from the given string.
[1] https:/ /click. palletsprojects .com/en/ 7.x/python3/ #python- 2-and-3- differences lucumr. pocoo.org/ 2013/7/ 2/the-updated- guide-to- unicode/ #different- types-of- unicode- strings
[2] http://