Merge pull request 'bugfix/ram-consumption' (#17) from bugfix/ram-consumption into main

Reviewed-on: https://git.walzen665.de/Walzen665/sharepulse/pulls/17
This commit is contained in:
Max W. 2024-03-09 21:39:33 +00:00
commit 9a84967804
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ plugins {
}
group = 'de.w665'
version = '1.1.0'
version = '1.1.1'
java {
sourceCompatibility = '21'

View File

@ -12,9 +12,11 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Date;
import java.util.Optional;
@ -95,8 +97,8 @@ public class FileService {
Path path = Paths.get(getTempDirPath() + File.separator + fileId);
try {
Files.write(path, file.getBytes());
try (InputStream inputStream = file.getInputStream()) {
Files.copy(inputStream, path, StandardCopyOption.REPLACE_EXISTING);
log.debug("File " + file.getOriginalFilename() + " written to " + path.getFileName());
return fileUpload;
} catch (IOException e) {