bug修复
This commit is contained in:
parent
6907615658
commit
0b861f0e21
@ -44,6 +44,6 @@ public abstract class AStorageAdapter implements IStorageAdapter {
|
||||
|
||||
@Override
|
||||
public String getUrlForUpload(String... path) {
|
||||
return getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), path);
|
||||
return getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "", path);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.OSSException;
|
||||
import com.aliyun.oss.model.DeleteObjectsRequest;
|
||||
import com.aliyun.oss.model.GeneratePresignedUrlRequest;
|
||||
import com.aliyun.oss.model.ListObjectsV2Request;
|
||||
import com.aliyun.oss.model.ListObjectsV2Result;
|
||||
import com.aliyun.oss.model.OSSObjectSummary;
|
||||
@ -25,6 +26,7 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -99,9 +101,14 @@ final public class AliOssAdapter extends AStorageAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrlForUpload(Date expireDate, String... path) {
|
||||
public String getUrlForUpload(Date expireDate, String contentType, String... path) {
|
||||
OSS ossClient = getOssClient();
|
||||
URL url = ossClient.generatePresignedUrl(config.getBucketName(), buildPath(path), expireDate, HttpMethod.PUT);
|
||||
GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(config.getBucketName(), buildPath(path), HttpMethod.PUT);
|
||||
if (StringUtils.isNotBlank(contentType)) {
|
||||
request.setContentType(contentType);
|
||||
}
|
||||
request.setExpiration(expireDate);
|
||||
URL url = ossClient.generatePresignedUrl(request);
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
@ -109,7 +116,7 @@ final public class AliOssAdapter extends AStorageAdapter {
|
||||
public List<StorageFileObject> listDir(String... path) {
|
||||
OSS ossClient = getOssClient();
|
||||
ListObjectsV2Request listObjectsV2Request = new ListObjectsV2Request(config.getBucketName());
|
||||
listObjectsV2Request.setPrefix(buildPath(path));
|
||||
listObjectsV2Request.setPrefix(buildPath(path) + "/");
|
||||
listObjectsV2Request.setMaxKeys(1000);
|
||||
boolean isTruncated = true;
|
||||
String continuationToken = null;
|
||||
|
@ -21,7 +21,7 @@ public interface IStorageAdapter {
|
||||
String getUrlForDownload(String ...path);
|
||||
String getUrlForDownload(Date expireDate, String ...path);
|
||||
String getUrlForUpload(String ...path);
|
||||
String getUrlForUpload(Date expireDate, String ...path);
|
||||
String getUrlForUpload(Date expireDate, String contentType, String... path);
|
||||
List<StorageFileObject> listDir(String ...path);
|
||||
boolean deleteDir(String ...path);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public class LocalStorageAdapter extends AStorageAdapter{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrlForUpload(Date expireDate, String... path) {
|
||||
public String getUrlForUpload(Date expireDate, String contentType, String... path) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user