Commit 62b5d96f by Sony Montoya Eslava

[FIXED] getFile

parent f6da5199
......@@ -3,6 +3,7 @@ package web.multitask.trismegistoservices.services.google;
import java.io.*;
import java.nio.file.Files;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
import lombok.AllArgsConstructor;
import org.json.JSONObject;
......@@ -94,6 +95,18 @@ public class DriveService implements IDriveService {
Resource resource = commonUtils.fileToResource(tempFile);
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName());
CompletableFuture.runAsync(() -> {
try {
Thread.sleep(15000);
if (tempFile.exists()) {
tempFile.delete();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
});
return ResponseEntity.ok()
.headers(headers)
.contentLength(tempFile.length())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment