Browse Source

没有文件时读取的问题

pull/1/head
richie 4 years ago
parent
commit
8c04322317
  1. 4
      src/main/java/com/fanruan/fs/s3/repository/core/S3ResourceRepository.java

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

@ -104,7 +104,11 @@ public class S3ResourceRepository extends BaseResourceRepository {
@Override @Override
public InputStream read(String filePath) throws ResourceIOException { public InputStream read(String filePath) throws ResourceIOException {
GetObjectRequest request = new GetObjectRequest(bucket, filePath); GetObjectRequest request = new GetObjectRequest(bucket, filePath);
try {
return s3.getObject(request).getObjectContent(); return s3.getObject(request).getObjectContent();
} catch (Exception e) {
return new ByteArrayInputStream(new byte[0]);
}
} }
@Override @Override

Loading…
Cancel
Save