|
|
|
@ -32,6 +32,7 @@ import java.io.FileOutputStream;
|
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.net.URL; |
|
|
|
|
import java.net.URLConnection; |
|
|
|
|
import java.nio.file.Files; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@ -161,7 +162,7 @@ public class S3ResourceRepository extends BaseResourceRepository {
|
|
|
|
|
if (inputStream.available() > LENGTH_LIMIT) { |
|
|
|
|
final long l1 = System.currentTimeMillis(); |
|
|
|
|
final File file = new File(l1 + LINK_SYMBOL + RandomUtils.randomId(5)); |
|
|
|
|
file.deleteOnExit(); |
|
|
|
|
Files.deleteIfExists(file.toPath()); |
|
|
|
|
file.createNewFile(); |
|
|
|
|
try (final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file));) { |
|
|
|
|
final long l = inputStream.transferTo(bufferedOutputStream); |
|
|
|
@ -177,6 +178,7 @@ public class S3ResourceRepository extends BaseResourceRepository {
|
|
|
|
|
// Optionally, wait for the upload to finish before continuing.
|
|
|
|
|
upload.waitForCompletion(); |
|
|
|
|
} finally { |
|
|
|
|
Files.deleteIfExists(file.toPath()); |
|
|
|
|
file.deleteOnExit(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|