Fixed string size calculation in _validate_and_return_file_permission
This commit is contained in:
Родитель
8f10e922c3
Коммит
0121c693ef
|
@ -73,11 +73,11 @@ def _validate_and_format_range_headers(request, start_range, end_range, start_ra
|
|||
|
||||
|
||||
def _validate_and_return_file_permission(file_permission, file_permission_key, default_permission):
|
||||
# if file_permission and file_permission are both empty, then use the default_permission value as file permission
|
||||
# file_permission size should be <= 8KB, else file permission_key should be used
|
||||
# if file_permission and file_permission_key are both empty, then use the default_permission
|
||||
# value as file permission, file_permission size should be <= 8KB, else file permission_key should be used
|
||||
empty_file_permission = file_permission is None or len(file_permission) == 0
|
||||
empty_file_permission_key = file_permission_key is None or len(file_permission_key) == 0
|
||||
file_permission_size_too_big = getsizeof(file_permission) > 8 * 1024
|
||||
file_permission_size_too_big = False if file_permission is None else len(file_permission.encode('utf-8')) > 8 * 1024
|
||||
|
||||
if file_permission_size_too_big:
|
||||
raise ValueError(_FILE_PERMISSION_TOO_LONG)
|
||||
|
|
Загрузка…
Ссылка в новой задаче