|
|
@@ -24,7 +24,6 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.text.DateFormat;
|
|
|
@@ -111,22 +110,25 @@ public class ObjectBasicController {
|
|
|
String signature = postObject.getXAmzSignature();
|
|
|
String policy = postObject.getPolicy();
|
|
|
|
|
|
- String str[] = credential.split("/");
|
|
|
+ /*String str[] = credential.split("/");
|
|
|
String accessKeyId = str[0];
|
|
|
String dateStr = str[1];
|
|
|
String regionName = str[2];
|
|
|
String serviceName = str[3];
|
|
|
|
|
|
String secretAccessKey = redisString.get(accessKeyId);
|
|
|
- byte[] signingKey = OssUtil.getSigningKey(secretAccessKey, dateStr, regionName, serviceName);
|
|
|
+ byte[] signingKey = OssUtil.getSigningKey(secretAccessKey, dateStr, regionName, serviceName);*/
|
|
|
|
|
|
String objectName = postObject.getKey();
|
|
|
- String contentType = postObject.getContentType();
|
|
|
-
|
|
|
- MultipartFile file = postObject.getFile();
|
|
|
- long len = file.getSize();
|
|
|
- InputStream inputStream = file.getInputStream();
|
|
|
- putObjectService.postObject(objectName, len, contentType, inputStream);
|
|
|
+ MultipartFile multipartFile = postObject.getFile();
|
|
|
+ String tmpPath = String.format("/opt/tmp/tomcat/%s", UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ File tmpFile = new File(tmpPath);
|
|
|
+ multipartFile.transferTo(tmpFile);
|
|
|
+
|
|
|
+ FileInputStream fis = new FileInputStream(tmpFile);
|
|
|
+ String sha256sum = DigestUtil.sha256sum(fis);
|
|
|
+ putObjectService.putObject(objectName, tmpFile, sha256sum);
|
|
|
+ tmpFile.delete();
|
|
|
PostResponse postResponse = new PostResponse();
|
|
|
return WebResult.success(postResponse);
|
|
|
}
|