You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ku...@apache.org on 2024/07/19 09:57:20 UTC

(incubator-answer-plugins) branch main updated: fix(cdn): change path check

This is an automated email from the ASF dual-hosted git repository.

kumfo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git


The following commit(s) were added to refs/heads/main by this push:
     new 8f90014  fix(cdn): change path check
8f90014 is described below

commit 8f90014b3078463b4c049e96ee719d21e4fd974c
Author: kumfo <ku...@sifou.com>
AuthorDate: Fri Jul 19 17:55:46 2024 +0800

    fix(cdn): change path check
---
 cdn-aliyun/aliyun.go | 3 ++-
 cdn-s3/s3.go         | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cdn-aliyun/aliyun.go b/cdn-aliyun/aliyun.go
index c37564d..e89d81a 100644
--- a/cdn-aliyun/aliyun.go
+++ b/cdn-aliyun/aliyun.go
@@ -302,7 +302,8 @@ func (c *CDN) rebuildReader(file io.Reader, replaceMap map[string]string) io.Rea
 	for oldStr, newStr := range replaceMap {
 		if oldStr != "" {
 			if newStr == "" {
-				newStr = "\"" + c.GetStaticPrefix() + "/static"
+				prefix := c.Config.VisitUrlPrefix + c.Config.ObjectKeyPrefix
+				newStr = "\"" + prefix + "/static"
 			}
 			res = strings.ReplaceAll(res, oldStr, newStr)
 		}
diff --git a/cdn-s3/s3.go b/cdn-s3/s3.go
index a75bf8a..ccd7c8a 100644
--- a/cdn-s3/s3.go
+++ b/cdn-s3/s3.go
@@ -294,7 +294,8 @@ func (c *CDN) rebuildReader(file io.Reader, replaceMap map[string]string) io.Rea
 		for oldStr, newStr := range replaceMap {
 			if oldStr != "" {
 				if newStr == "" {
-					newStr = "\"" + c.GetStaticPrefix() + "/static"
+					prefix := c.Config.VisitUrlPrefix + c.Config.ObjectKeyPrefix
+					newStr = "\"" + prefix + "/static"
 				}
 				res = strings.ReplaceAll(res, oldStr, newStr)
 			}