Browse Source

文件名带有特殊字符的时候的问题

pull/1/head
richie 6 years ago
parent
commit
ae46581ba8
  1. 2
      plugin.xml
  2. 4
      src/main/java/com/fr/plugin/file/submit/oss/fun/OssDownloadHttpHandler.java
  3. 4
      src/main/resources/com/fr/plugin/file/submit/oss/web/oss.js

2
plugin.xml

@ -2,7 +2,7 @@
<id>com.fr.plugin.file.submit.oss</id>
<name><![CDATA[文件上传下载(OSS)]]></name>
<active>yes</active>
<version>2.1</version>
<version>2.3</version>
<env-version>10.0</env-version>
<jartime>2018-11-02</jartime>
<vendor>author</vendor>

4
src/main/java/com/fr/plugin/file/submit/oss/fun/OssDownloadHttpHandler.java

@ -4,7 +4,6 @@ import com.aliyun.oss.HttpMethod;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.GeneratePresignedUrlRequest;
import com.fr.data.NetworkHelper;
import com.fr.decision.fun.HttpHandler;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.plugin.file.submit.oss.conf.FileSubmitOssServerConfig;
import com.fr.stable.StableUtils;
@ -55,7 +54,8 @@ public class OssDownloadHttpHandler extends BaseHttpHandler {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE, 1);
Date expiration = calendar.getTime();
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, StableUtils.pathJoin(directory, fileName), HttpMethod.GET);
String key = StableUtils.pathJoin(directory, fileName);
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, key, HttpMethod.GET);
// 设置过期时间。
request.setExpiration(expiration);
// 生成签名URL(HTTP GET请求)。

4
src/main/resources/com/fr/plugin/file/submit/oss/web/oss.js

@ -69,8 +69,8 @@ $.extend(FR, {
data : {
sessionID: FR.SessionMgr.getSessionID(),
bucket : data.bucket,
directory : data.directory,
fileName : data.fileName
directory : encodeURIComponent(data.directory),
fileName : encodeURIComponent(data.fileName)
},
complete: function (res, status) {
window.open(res.responseText);

Loading…
Cancel
Save