Skip to content

Commit dcfe66b

Browse files
author
wubingheng
committed
udpate CommonParams to convert real savePath.
1 parent da42737 commit dcfe66b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/main/java/com/qiniu/entry/CommonParams.java

+2
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,8 @@ private void setSavePath() throws IOException {
12491249
savePath = "local".equals(source) ? (path.endsWith(FileUtils.pathSeparator) ?
12501250
path.substring(0, path.length() - 1) : path) + "-result" : bucket;
12511251
savePath = savePath.substring(savePath.lastIndexOf(FileUtils.pathSeparator) + 1);
1252+
} else {
1253+
savePath = FileUtils.convertToRealPath(savePath);
12521254
}
12531255
if (CloudApiUtils.isFileSource(source) && FileUtils.convertToRealPath(path).equals(FileUtils.convertToRealPath(savePath))) {
12541256
throw new IOException(String.format("the save-path \"%s\" can not be same as path.", savePath));

src/test/java/com/qiniu/process/aws/PrivateUrlTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void testProcessLine() throws Exception {
2020
String bucket = "7zmz4b";
2121
String region = "cn-east-1";
2222
String endpoint = "http://s3-cn-east-1.qiniucs.com";
23-
PrivateUrl privateUrl = new PrivateUrl(accessKeyId, accessKeySecret, bucket, endpoint, region, 3600000, null, "~/Downloads");
23+
PrivateUrl privateUrl = new PrivateUrl(accessKeyId, accessKeySecret, bucket, endpoint, region, false, 3600000, null, "~/Downloads");
2424
String result = privateUrl.singleResult(new HashMap<String, String>(){{
2525
put("key", "0000021");
2626
}});

src/test/java/com/qiniu/process/qiniu/CdnUrlProcessTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.qiniu.process.qiniu;
22

33
import com.qiniu.config.PropertiesFile;
4+
import com.qiniu.storage.Configuration;
45
import org.junit.Test;
56

67
import java.io.IOException;
@@ -17,7 +18,7 @@ public void testSingleRefresh() throws IOException {
1718
PropertiesFile propertiesFile = new PropertiesFile("resources/.application.properties");
1819
String accessKey = propertiesFile.getValue("ak");
1920
String secretKey = propertiesFile.getValue("sk");
20-
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, null, null, "url", false, false);
21+
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, new Configuration(), null, null, "url", false, false);
2122
String result = cdnUrlProcess.singleResult(new HashMap<String, String>(){{
2223
put("url", "http://xxx.cn/upload/24790f63-0936-44c4-8695-a6d6b1dd8d91.jpg");
2324
}});
@@ -30,7 +31,7 @@ public void testBatchRefresh() throws IOException {
3031
PropertiesFile propertiesFile = new PropertiesFile("resources/.application.properties");
3132
String accessKey = propertiesFile.getValue("ak");
3233
String secretKey = propertiesFile.getValue("sk");
33-
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, null, null, "url", true, false,
34+
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, new Configuration(), null, null, "url", true, false,
3435
"/Users/wubingheng/Downloads/refresh");
3536
List<Map<String, String>> list = new ArrayList<>();
3637
// list.add(new HashMap<String, String>(){{
@@ -64,7 +65,7 @@ public void testBatchPrefetch() throws IOException {
6465
PropertiesFile propertiesFile = new PropertiesFile("resources/.application.properties");
6566
String accessKey = propertiesFile.getValue("ak");
6667
String secretKey = propertiesFile.getValue("sk");
67-
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, null, null, "url", false, true,
68+
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, new Configuration(), null, null, "url", false, true,
6869
"/Users/wubingheng/Downloads/refresh");
6970
List<Map<String, String>> list = new ArrayList<>();
7071
list.add(new HashMap<String, String>(){{
@@ -85,7 +86,7 @@ public void testClone() throws IOException, CloneNotSupportedException {
8586
PropertiesFile propertiesFile = new PropertiesFile("resources/.application.properties");
8687
String accessKey = propertiesFile.getValue("ak");
8788
String secretKey = propertiesFile.getValue("sk");
88-
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, null, null, "url", false, true,
89+
CdnUrlProcess cdnUrlProcess = new CdnUrlProcess(accessKey, secretKey, new Configuration(), null, null, "url", false, true,
8990
"/Users/wubingheng/Downloads/refresh");
9091
System.out.println(cdnUrlProcess);
9192
CdnUrlProcess cdnUrlProcess1 = cdnUrlProcess.clone();

src/test/java/com/qiniu/process/tencent/PrivateUrlTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void testProcessLine() throws Exception {
1919
String accessKeySecret = propertiesFile.getValue("ten-secret");
2020
String bucket = propertiesFile.getValue("bucket");
2121
String region = "ap-shanghai";
22-
PrivateUrl privateUrl = new PrivateUrl(accessKeyId, accessKeySecret, bucket, region, 3600, null, "~/Downloads");
22+
PrivateUrl privateUrl = new PrivateUrl(accessKeyId, accessKeySecret, bucket, region, false, 3600, null, "~/Downloads");
2323
String result = privateUrl.singleResult(new HashMap<String, String>(){{
2424
put("key", "24790f63-0936-44c4-8695-a6d6b1dd8d91.jpg");
2525
}});

0 commit comments

Comments
 (0)