diff --git a/backend/src/main/java/com/zzang/chongdae/offering/service/OgTagProductImageExtractor.java b/backend/src/main/java/com/zzang/chongdae/offering/service/OgTagProductImageExtractor.java index e5867ce3..62beec85 100644 --- a/backend/src/main/java/com/zzang/chongdae/offering/service/OgTagProductImageExtractor.java +++ b/backend/src/main/java/com/zzang/chongdae/offering/service/OgTagProductImageExtractor.java @@ -13,6 +13,16 @@ public class OgTagProductImageExtractor implements ProductImageExtractor { @Override public String extract(String productUrl) { String html = htmlCrawler.scrap(productUrl); - return htmlCrawler.parseOpenGraph(html, OG_IMAGE_PROPERTY); + return removeHttpHttps(htmlCrawler.parseOpenGraph(html, OG_IMAGE_PROPERTY)); + } + + public String removeHttpHttps(String url) { + if (url.startsWith("http:")) { + return url.substring("http:".length()); + } + if (url.startsWith("https:")) { + return url.substring("https:".length()); + } + return url; } }