From eb437915956ddf0af9b723d04018b420badc0906 Mon Sep 17 00:00:00 2001 From: remillet Date: Thu, 14 Jan 2016 17:23:54 -0800 Subject: [PATCH] CSPACE-6843: Added support for external media with HTTPS URLs. --- .../services/common/blob/BlobInput.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java index 222634c48..dc9e24889 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java +++ b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java @@ -180,11 +180,21 @@ public class BlobInput { this.setBlobUri(blobUri); } + private boolean isProtocolHttp(URL url) { + boolean result = false; + + if (url.getProtocol().equalsIgnoreCase("http") || + url.getProtocol().equalsIgnoreCase("https")) { + result = true; + } + + return result; + } + public void createBlobFile(String theBlobUri) throws MalformedURLException, Exception { URL blobUrl = new URL(theBlobUri); File theBlobFile = null; - - if (blobUrl.getProtocol().equalsIgnoreCase("http")) { //REM: Add support for https as well + if (isProtocolHttp(blobUrl) == true) { Download fetchedFile = new Download(blobUrl); if (logger.isDebugEnabled() == true) { logger.debug("Starting blob download into temp file:" + fetchedFile.getFilePath()); -- 2.47.3