From 8cc1d576578c5b7fb5a04d96d9326bdecdaa6e9e Mon Sep 17 00:00:00 2001 From: Muhammad Afaq Shuaib Date: Tue, 3 Sep 2024 12:09:55 +0500 Subject: [PATCH] fix: decoding of google_service_account_credentials (#4422) --- course_discovery/settings/production.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/course_discovery/settings/production.py b/course_discovery/settings/production.py index 93d45a43f4..bb2c408853 100644 --- a/course_discovery/settings/production.py +++ b/course_discovery/settings/production.py @@ -89,5 +89,8 @@ # Have images and such that we upload be publicly readable AWS_DEFAULT_ACL = 'public-read' -# Convert dict keys to lowercase -GOOGLE_SERVICE_ACCOUNT_CREDENTIALS = {k.lower(): v for k, v in GOOGLE_SERVICE_ACCOUNT_CREDENTIALS.items()} +# Convert dict keys to lowercase. The if condition replaces \\n in private_key value with \n. +GOOGLE_SERVICE_ACCOUNT_CREDENTIALS = { + k.lower(): (v.replace("\\n", "\n") if k.lower() == "private_key" else v) + for (k, v) in GOOGLE_SERVICE_ACCOUNT_CREDENTIALS.items() +}