From b9876d91289ee25d6f33ad3849adf045c2bd0c91 Mon Sep 17 00:00:00 2001 From: BharathwajShankar <saialumnibharathwaj@gmail.com> Date: Mon, 9 Jan 2023 17:21:21 +0530 Subject: [PATCH] LR-278 - CLONE - File URL is not having new cname changes fix in method --- .../qrcodedownload/QRCodeDownloadManagementActor.java | 9 ++++++--- .../java/org/sunbird/common/models/util/JsonKey.java | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java index ef78dfdb0..66b288a6c 100644 --- a/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java +++ b/course-mw/course-actors-common/src/main/java/org/sunbird/learner/actors/qrcodedownload/QRCodeDownloadManagementActor.java @@ -233,10 +233,13 @@ public class QRCodeDownloadManagementActor extends BaseActor { List<Map<String, Object>> listOfMap = (List<Map<String, Object>>) obj; if (CollectionUtils.isNotEmpty(listOfMap)) { //TODO Resolve it and store. Assuming dial code db will have the template url with data migration script - String templateUrl = (String) listOfMap.get(0).get("url"); + //replace template url with the actual cloud url - if (templateUrl.contains(getConfigValue(DIAL_STORAGE_BASE_PATH))) - templateUrl = templateUrl.replace(getConfigValue(DIAL_STORAGE_BASE_PATH), getConfigValue(CLOUD_STORE_BASE_PATH)); + String templateUrl = (String) listOfMap.get(0).get("url"); + if (templateUrl.contains(getConfigValue(DIAL_STORAGE_BASE_PATH_PLACEHOLDER))) + templateUrl = templateUrl.replace(getConfigValue(DIAL_STORAGE_BASE_PATH_PLACEHOLDER), + getConfigValue(CLOUD_STORE_BASE_PATH)+"/"+ + getConfigValue(CLOUD_STORAGE_DIAL_BUCKET_NAME)); return templateUrl; } } diff --git a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java index ff709664c..022304bad 100644 --- a/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java +++ b/course-mw/sunbird-util/sunbird-platform-core/common-util/src/main/java/org/sunbird/common/models/util/JsonKey.java @@ -3,8 +3,6 @@ package org.sunbird.common.models.util; import java.util.Arrays; import java.util.List; -import static org.sunbird.common.models.util.ProjectUtil.getConfigValue; - /** * This class will contains all the key related to request and response. * @@ -791,9 +789,12 @@ public final class JsonKey { public static final String CLOUD_FOLDER_CONTENT = "sunbird_cloud_content_folder"; public static final String CLOUD_STORE_BASE_PATH = "cloud_storage_base_url"; + + public static final String CLOUD_STORAGE_DIAL_BUCKET_NAME = "cloud_storage_dial_bucketname"; + + public static final String DIAL_STORAGE_BASE_PATH_PLACEHOLDER="DIAL_STORAGE_BASE_PATH"; + public static final String CLOUD_STORE_BASE_PATH_PLACEHOLDER = "cloud_store_base_path_placeholder"; - public static final String DIAL_STORAGE_BASE_PATH = getConfigValue("cloud_storage_base_url") +"/"+ - getConfigValue("cloud_storage_dial_bucketname"); public static final String TO_URL = "toUrl"; public static final String TTL = "ttl"; public static final String TEXTBOOK_TOC_CSV_TTL = "sunbird_texbook_toc_csv_ttl"; -- GitLab