From 6b86038d65f2ee0d2461ffb65a6bfd6f5303181a Mon Sep 17 00:00:00 2001 From: Benjamin-bc-gov Date: Sat, 21 Nov 2026 17:47:38 -0600 Subject: [PATCH] 32781 - accept any page size for court order documents --- legal-api/pyproject.toml | 2 +- .../filings/validations/common_validations.py | 6 +++++- .../services/filings/validations/test_court_order.py | 11 +++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/legal-api/pyproject.toml b/legal-api/pyproject.toml index 1688b60739..486b125845 100644 --- a/legal-api/pyproject.toml +++ b/legal-api/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "legal-api" -version = "3.1.78" +version = "3.1.79" description = "" authors = [ {name = "thor",email = "1042854+thorwolpert@users.noreply.github.com"} diff --git a/legal-api/src/legal_api/services/filings/validations/common_validations.py b/legal-api/src/legal_api/services/filings/validations/common_validations.py index ee3b50f8f4..15771e5406 100644 --- a/legal-api/src/legal_api/services/filings/validations/common_validations.py +++ b/legal-api/src/legal_api/services/filings/validations/common_validations.py @@ -611,7 +611,10 @@ def _validate_court_order_documents(court_order_path, court_order, is_file_and_d msg.append({"error": _("Court Order is required (in orderDetails/fileKey/files)."), "path": court_order_path}) if file_key: - msg.extend(validate_pdf(file_key, f"{court_order_path}/fileKey", max_file_size=MAX_COURT_ORDER_FILE_SIZE)) + msg.extend(validate_pdf(file_key, + f"{court_order_path}/fileKey", + verify_paper_size=False, + max_file_size=MAX_COURT_ORDER_FILE_SIZE)) elif files: msg.extend(_validate_court_order_documents_list(f"{court_order_path}/files", files, existing_file_keys)) @@ -631,6 +634,7 @@ def _validate_court_order_documents_list(files_path, files, existing_file_keys): msg.extend(validate_pdf(file.get("fileKey"), f"{files_path}/{file_index}/fileKey", + verify_paper_size=False, max_file_size=MAX_COURT_ORDER_FILE_SIZE)) if court_order_document_count == 0: # if only supporting documents and no court order documents were found diff --git a/legal-api/tests/unit/services/filings/validations/test_court_order.py b/legal-api/tests/unit/services/filings/validations/test_court_order.py index 67d859aba8..96afe95ddb 100644 --- a/legal-api/tests/unit/services/filings/validations/test_court_order.py +++ b/legal-api/tests/unit/services/filings/validations/test_court_order.py @@ -144,10 +144,8 @@ def test_court_order_invalid_effect_of_order(session, monkeypatch, is_migrated, 'test_name, expected_code, expected_msg', [ ('SUCCESS', None, None), - ('FAIL_INVALID_FILE_KEY', HTTPStatus.BAD_REQUEST, [{'error': 'Invalid file.', 'path': file_key_path}]), - ('FAIL_INVALID_FILE_KEY_SIZE', HTTPStatus.BAD_REQUEST, [{ - 'error': 'Document must be set to fit onto 8.5” x 11” letter-size paper.', - 'path': file_key_path}]) + ('SUCCESS_NON_LETTER_PAGE_SIZE', None, None), + ('FAIL_INVALID_FILE_KEY', HTTPStatus.BAD_REQUEST, [{'error': 'Invalid file.', 'path': file_key_path}]) ]) def test_court_order_file(session, monkeypatch, test_name, expected_code, expected_msg, is_file_key): """Assert valid court order.""" @@ -158,7 +156,8 @@ def test_court_order_file(session, monkeypatch, test_name, expected_code, expect if is_file_key: if test_name == 'SUCCESS': filing['filing']['courtOrder']['fileKey'] = _upload_file(letter, invalid=False) - elif test_name == 'FAIL_INVALID_FILE_KEY_SIZE': + elif test_name == 'SUCCESS_NON_LETTER_PAGE_SIZE': + # court order documents are accepted at any page size (legal size is common for court documents) filing['filing']['courtOrder']['fileKey'] = _upload_file(letter, invalid=True) else: files = [] @@ -171,7 +170,7 @@ def test_court_order_file(session, monkeypatch, test_name, expected_code, expect else: files.append({ "fileName": "test_file.pdf", - "fileKey": _upload_file(letter, invalid=(test_name == 'FAIL_INVALID_FILE_KEY_SIZE')), + "fileKey": _upload_file(letter, invalid=(test_name == 'SUCCESS_NON_LETTER_PAGE_SIZE')), "documentType": "court_order" }) del filing['filing']['courtOrder']['fileKey']