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

24632 create upload document #3141

Open
wants to merge 2 commits into
base: feature-drs-integration
Choose a base branch
from

Conversation

flutistar
Copy link
Collaborator

Issue #: /bcgov/entity#24632
Description of changes:

  • Added document_record Service
  • Created upload/delete document APIs
  • Added 3 ENV variables
  • Moved pdf validation(max size, encryption) from filing process to document upload

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the lear license (Apache 2.0).

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

if not file:
current_app.logger.debug('No file found in request.')
return {'data': 'File not provided'}
current_app.logger.debug(f'Upload file to document record service {file.filename}')

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
Copy link

@doug-lovett doug-lovett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Comment on lines -129 to -132
if file_key := foreign_jurisdiction.get('affidavitFileKey'):
if err := validate_pdf(file_key, affidavit_file_key_path, False):
msg.extend(err)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to validate if a file exist or not against this key

@@ -51,7 +51,6 @@ def validate(filing_json: dict) -> Optional[Error]: # pylint: disable=too-many-
return msg # Cannot continue validation without legal_type

msg.extend(validate_business_in_colin(filing_json, filing_type))
msg.extend(validate_continuation_in_authorization(filing_json, filing_type))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to validate if a file exist or not against this key

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so I moved other validations to file submission.
I will add a validation to check if file exists.

@vysakh-menon-aot
Copy link
Collaborator

vysakh-menon-aot commented Dec 20, 2024

Are we moving away from the minio file upload in legal-api? then we need to update COOP file upload (rules and memorandum) in various filings and dissolution and court order file upload.

Comment on lines +107 to +110
# Check that all pages in the pdf are letter size and able to be processed.
if any(x.mediaBox.getWidth() != 612 or x.mediaBox.getHeight() != 792 for x in pdf_reader.pages):
msg.append({'error': _('Document must be set to fit onto 8.5” x 11” letter-size paper.'),
'path': file.filename})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flutistar
Copy link
Collaborator Author

Are we moving away from the minio file upload in legal-api? then we need to update COOP file upload (rules and memorandum) in various filings and dissolution and court order file upload.

Yes, we are replacing Minio with Document Record Service, but for now Continuation In only as a Proof of Concept.

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.

3 participants