# HG changeset patch # User John Rouillard # Date 1733951748 18000 # Node ID d87350f56100a6f1eca386816bb41570fed2ef65 # Parent 894eabf95385c0fc018ee6bdecc20bdc7b9a52ae chore(ruff): use variable not magic number. diff -r 894eabf95385 -r d87350f56100 roundup/rest.py --- a/roundup/rest.py Wed Dec 11 15:26:32 2024 -0500 +++ b/roundup/rest.py Wed Dec 11 16:15:48 2024 -0500 @@ -2236,6 +2236,8 @@ error """ + MAX_MIME_EXTENSION_LENGTH = 11 # application in /etc/mime.types + # get the request format for response # priority : extension from uri (/rest/data/issue.json) # only json or xml valid at this time. @@ -2248,11 +2250,12 @@ # such as .vcard for downloading user info can be # supported. This method also allow detection of mistyped # types like jon for json. Limit extension length to less than - # 10 characters to allow passing JWT via URL path. Could be - # useful for magic link login method or account recovery workflow, - # using a JWT with a short expiration time and limited rights - # (e.g. only password change permission)) - if ext_type and (len(ext_type) < 10): + # MAX_MIME_EXTENSION_LENGTH characters to allow passing JWT + # via URL path. Could be useful for magic link login method or + # account recovery workflow, using a JWT with a short + # expiration time and limited rights (e.g. only password + # change permission)) + if ext_type and (len(ext_type) < MAX_MIME_EXTENSION_LENGTH): if ext_type not in list(self.__accepted_content_type.values()): self.client.response_code = 406 return (None, uri,