Skip to content

Commit 2331ab5

Browse files
committed
chore(ruff): use variable not magic number.
1 parent e37a461 commit 2331ab5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

roundup/rest.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,6 +2236,8 @@ def determine_output_format(self, uri):
22362236
error
22372237
22382238
"""
2239+
MAX_MIME_EXTENSION_LENGTH = 11 # application in /etc/mime.types
2240+
22392241
# get the request format for response
22402242
# priority : extension from uri (/rest/data/issue.json)
22412243
# only json or xml valid at this time.
@@ -2248,11 +2250,12 @@ def determine_output_format(self, uri):
22482250
# such as .vcard for downloading user info can be
22492251
# supported. This method also allow detection of mistyped
22502252
# types like jon for json. Limit extension length to less than
2251-
# 10 characters to allow passing JWT via URL path. Could be
2252-
# useful for magic link login method or account recovery workflow,
2253-
# using a JWT with a short expiration time and limited rights
2254-
# (e.g. only password change permission))
2255-
if ext_type and (len(ext_type) < 10):
2253+
# MAX_MIME_EXTENSION_LENGTH characters to allow passing JWT
2254+
# via URL path. Could be useful for magic link login method or
2255+
# account recovery workflow, using a JWT with a short
2256+
# expiration time and limited rights (e.g. only password
2257+
# change permission))
2258+
if ext_type and (len(ext_type) < MAX_MIME_EXTENSION_LENGTH):
22562259
if ext_type not in list(self.__accepted_content_type.values()):
22572260
self.client.response_code = 406
22582261
return (None, uri,

0 commit comments

Comments
 (0)