Skip to content

Scanning malicious files before upload#7

Open
shubhamj99 wants to merge 1 commit intogauranshkumar:masterfrom
shubhamj99:master
Open

Scanning malicious files before upload#7
shubhamj99 wants to merge 1 commit intogauranshkumar:masterfrom
shubhamj99:master

Conversation

@shubhamj99
Copy link
Copy Markdown

"this commit fixes #6 "

@gauranshkumar
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

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

@gauranshkumar
Copy link
Copy Markdown
Owner

Sure 👍🏼

@gauranshkumar
Copy link
Copy Markdown
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