[PATCH 03 of 11] py3: raw stringify various things in the LFS server module
Yuya Nishihara
yuya at tcha.org
Sat Feb 2 20:44:03 EST 2019
On Sat, 02 Feb 2019 13:23:18 -0500, Matt Harbison wrote:
> On Mon, 28 Jan 2019 06:58:40 -0500, Yuya Nishihara <yuya at tcha.org> wrote:
> > On Mon, 28 Jan 2019 00:20:49 -0500, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison at yahoo.com>
> >> # Date 1548568239 18000
> >> # Sun Jan 27 00:50:39 2019 -0500
> >> # Node ID 9a35d8754bdfaac20d1931dbd6a82233d11f4722
> >> # Parent 7768ad6f53d8e08e90918e50201fc2fab4f9eff6
> >> py3: raw stringify various things in the LFS server module
> >
> >> - operation = lfsreq.get('operation')
> >> - if operation not in ('upload', 'download'):
> >> + operation = lfsreq.get(r'operation')
> >> + operation = pycompat.bytestr(operation)
> >
> > If we don't care non-ASCII "operation" value and don't want Unicode
> > exception,
> > using pycompat.sysbytes() is safer.
>
> I don't think we care, because there are only 3 defined values, and they
> are all ASCII. From a philosophical POV, wouldn't we *want* it to explode
> if someone put a garbage value in, instead of masking it by either
> ignoring or replacing bad bytes? The only difference I guess is between a
> 4xx and 500 error code.
I think 4xx (Bad Requests) is the proper way to report the error since
'uploàd' is merely an unsupported operation.
More information about the Mercurial-devel
mailing list