Skip to content

Commit a9368a7

Browse files
committed
cast provider size metadata to int before comparing
* GoogleDrive returns its file size metadata as a string rather than an int. This was causing the max tabular file size checker to fail because we were trying to compare the metadata size (a str) to the configured maximum (an int).
1 parent fdacfc3 commit a9368a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mfr/providers/osf/provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ async def metadata(self):
102102
size = metadata['data']['size']
103103

104104
max_file_size = MAX_FILE_SIZE_TO_RENDER.get(ext)
105-
if max_file_size and size and size > max_file_size:
105+
if max_file_size and size and int(size) > max_file_size:
106106
raise TooBigToRenderError(
107107
"This file with extension '{ext}' exceeds the size limit of {max_size} and will not "
108108
"be rendered. To view this file download it and view it "
109109
"offline.".format(ext=ext, max_size=sizeof_fmt(max_file_size)),
110-
requested_size=size, maximum_size=max_file_size,
110+
requested_size=int(size), maximum_size=max_file_size,
111111
)
112112

113113
content_type = metadata['data']['contentType'] or mimetypes.guess_type(metadata['data']['name'])[0]

0 commit comments

Comments
 (0)