Browse Source

Pull request #1340: 无jira任务 fix: 修改下preserveMetadata配置的效果

Merge in PG/plugin-repository-s3 from ~AFLY/plugin-repository-s3:release/11.0 to release/11.0

* commit 'fe89ed9439cda2a8c2ee67b094e153d5643d0947':
  无jira任务 fix: 修改下preserveMetadata配置的效果
release/11.0
Afly-储泓飞 3 months ago
parent
commit
f7ac7f6d31
  1. 14
      src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

14
src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

@ -175,15 +175,15 @@ public class S3ResourceRepository extends BaseResourceRepository {
metadata = s3.getObjectMetadata(bucket, path);
} catch (Exception ignore) {
}
}
if (metadata == null) {
metadata = new ObjectMetadata();
String mimeType = URLConnection.guessContentTypeFromName(path);
if (mimeType != null) {
metadata.setContentType(mimeType);
if (metadata == null) {
metadata = new ObjectMetadata();
String mimeType = URLConnection.guessContentTypeFromName(path);
if (mimeType != null) {
metadata.setContentType(mimeType);
}
}
metadata.setContentLength(length);
}
metadata.setContentLength(length);
s3.putObject(bucket, path, new ByteArrayInputStream(data), metadata);
}
}

Loading…
Cancel
Save