Skip to content
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

Scanning malicious files before upload #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shubhamj99
Copy link

"this commit fixes #6 "

@gauranshkumar
Copy link
Owner

@shubhamj99 There is a small issue in the PR

TypeError: expected str, bytes or os.PathLike object, not UploadedFile
Traceback:
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/streamlit/script_runner.py", line 351, in _run_script
    self._session_state.call_callbacks()
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/streamlit/state/session_state.py", line 490, in call_callbacks
    self._new_widget_state.call_callback(wid)
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/streamlit/state/session_state.py", line 220, in call_callback
    callback(*args, **kwargs)
File "/home/gauransh/Code/chithi/src/app.py", line 116, in mail
    mailer.send_mail(to=recipients, cc=cc, bcc=bcc, subject=subject,
File "/home/gauransh/Code/chithi/src/mailer.py", line 73, in send_mail
    api_response = api_instance.scan_file(files)
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/cloudmersive_virus_api_client/api/scan_api.py", line 55, in scan_file
    (data) = self.scan_file_with_http_info(input_file, **kwargs)  # noqa: E501
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/cloudmersive_virus_api_client/api/scan_api.py", line 119, in scan_file_with_http_info
    return self.api_client.call_api(
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/cloudmersive_virus_api_client/api_client.py", line 325, in call_api
    return self.__call_api(resource_path, method,
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/cloudmersive_virus_api_client/api_client.py", line 141, in __call_api
    post_params = self.prepare_post_parameters(post_params, files)
File "/home/gauransh/Code/chithi/lib/python3.9/site-packages/cloudmersive_virus_api_client/api_client.py", line 451, in prepare_post_parameters
    with open(n, 'rb') as f:

The possible solution to this could be not reading the files as binary rather sending the FIleObject as it is or as a byte stream.
For further reference please have a look at the streamlit Documentation here

@gauranshkumar
Copy link
Owner

Also, Is this key in the commit belongs to you, if yes then please don't share it in public and use a secure way to use it maybe by exporting the key as an Environment Variable and using it via os.getenv(key)

@shubhamj99
Copy link
Author

Ok I'll look into this, I didn't get that error before. Thanks for the feedback.

@gauranshkumar
Copy link
Owner

Sure 👍🏼

@gauranshkumar
Copy link
Owner

Hey, @shubhamj99 any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Solidifiaction of the current App
2 participants