-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constrain file sizes #50
Conversation
file_data = data.read() | ||
mimetype = _guess_mimetype(file_data) | ||
file_name = data.name | ||
|
||
if mimetype == "application/pdf": | ||
number_of_pages = _get_pdf_page_count(file_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fail or extract from first few pages what do you think is more intuitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is OK for now obviously)
@@ -112,7 +112,7 @@ async def test_extract_from_file() -> None: | |||
|
|||
# We'll use multi-form data here. | |||
# Create a named temporary file | |||
with tempfile.NamedTemporaryFile(mode="w+t", delete=False) as f: | |||
with tempfile.NamedTemporaryFile(mode="w+t", delete=True) as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest separate unit test since it's getting pretty long on one api test
Closes #49