From a0dc02f108695f2229b20008715b6cf0cd0b751f Mon Sep 17 00:00:00 2001 From: Michael Volo Date: Tue, 15 Oct 2024 17:14:20 -0500 Subject: [PATCH] add file extension to downloaded image --- salesforce/management/commands/update_partners.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salesforce/management/commands/update_partners.py b/salesforce/management/commands/update_partners.py index 12412fe6..df35e608 100644 --- a/salesforce/management/commands/update_partners.py +++ b/salesforce/management/commands/update_partners.py @@ -260,10 +260,10 @@ def handle(self, *args, **options): try: document_id = document_query['records'][0]['ContentDocumentId'] - version_query = sf.query("SELECT Id, CreatedDate, Title, VersionData FROM ContentVersion WHERE Title LIKE '%public_logo%' AND ContentDocumentId = '{}' ORDER BY CreatedDate DESC".format(document_id)) + version_query = sf.query("SELECT Id, CreatedDate, Title, FileExtension, VersionData FROM ContentVersion WHERE Title LIKE '%public_logo%' AND ContentDocumentId = '{}' ORDER BY CreatedDate DESC".format(document_id)) content_version = version_query['records'][0] if content_version: - content_title = content_version['Title'] + content_title = "{}.{}".format(content_version['Title'], content_version['FileExtension']) file_url = "https://openstax.my.salesforce.com" + content_version['VersionData'] headers = {