Skip to content

API ledger client document url updates - #4648

Open
doug-lovett wants to merge 3 commits into
bcgov:mainfrom
doug-lovett:34436-api-minio-drs-ledger-urls
Open

API ledger client document url updates#4648
doug-lovett wants to merge 3 commits into
bcgov:mainfrom
doug-lovett:34436-api-minio-drs-ledger-urls

Conversation

@doug-lovett

Copy link
Copy Markdown
Collaborator

Issue #: /bcgov/entity#34436

Description of changes:
Update the filing ledger download URL set up for client documents after switching from Minio to DRS.

  • Use the DRS file key to build the download URL if available.
  • Add missing document types to the configuration used to build the download URL.
  • Review/update DRS documents types in existing configuration used to build the download URL.

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).

Signed-off-by: Doug Lovett <doug@diamante.ca>
@doug-lovett doug-lovett self-assigned this Aug 1, 2026

@kialj876 kialj876 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking pretty good, but I think there's a few minor issues below

name: str = static_doc.get("name")
doc_name: str = doc.get("name", "")
if (doc_name):
if name.removesuffix(".pdf") == doc_name.removesuffix(".pdf"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this will bail if 'name' is None. Add 'name' to the if?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Check added above even though the name is the ledger download name and a defect somewhere else if it does not exist.

# Try partial matching static doc name with default name.
for key, value in STATIC_DOCUMENTS.items():
if (
name.startswith(str(key)) and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this also looks like it will bail when 'name' is None

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

See my previous comment.

(False, STATIC_URL3, "Test court order", DRS_TEST_DOC, "CORP", "CRTO", "DS0000101951", "Test court order.pdf"),
(False, STATIC_URL2, "Test court order", DRS_TEST_DOC, "CORP", "CRTO", "DS0000101952", ""),
(False, STATIC_URL1, "Court Order 1234", DRS_TEST_DOC, "CORP", "COSD", "DS0000101951", ""),
(False, STATIC_URL1, "Court Order 1234", DRS_TEST_DOC, "CORP", "COSD", "DS0000101951", "Court Order.pdf"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

can you add a case here for the 'drs_filename' as None? Is 'None' possible for migrated minio documents without a name or would they evaluate to empty strings?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added: the DRS API returns an empty string instead of None if no file name exists.

if name.removesuffix(".pdf") == doc_name.removesuffix(".pdf"):
return True
if (
STATIC_DOCUMENTS.get(name) == name and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is a dict to str comparison here? It will always be False

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for catching, fixed.

name: str = static_doc.get("name")
if (name and name == doc.get("name")) or (
name and STATIC_DOCUMENTS.get(name) and
doc.get("documentClass") == STATIC_DOCUMENTS[name].get("documentClass") and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We're no longer checking against this at all inside 'is_static_doc_match' is that on purpose? I saw you introduce a wild card for this for court order which means this would need to change a bit if it was kept in. Or if we're not going to use 'documentClass' in STATIC_DOCUMENTS for anything can it be removed from the dict?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Class removed as an unnecessary check.

Signed-off-by: Doug Lovett <doug@diamante.ca>
Signed-off-by: Doug Lovett <doug@diamante.ca>
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

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.

4 participants