Skip to content

Commit

Permalink
Fix: Sonar cloud security hotspot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnKennedy-A committed Apr 8, 2024
1 parent d4c51c9 commit 45922e6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.GeneralSecurityException;
import java.time.Instant;
import java.time.ZoneId;
Expand Down Expand Up @@ -507,8 +508,10 @@ public String uploadSignature(MultipartFile file, Long patientTrackId, Long pati
*/
private File convertMultipartFileToFile(MultipartFile file) {
File convertedFile = null;
String targetDirectory = filePath;
Path targetPath = new File(targetDirectory).toPath().normalize();
if (Objects.nonNull(file) && Objects.nonNull(file.getOriginalFilename())) {
convertedFile = new File(file.getOriginalFilename());
convertedFile = new File(targetPath + file.getOriginalFilename());
try (FileOutputStream fos = new FileOutputStream(convertedFile)) {
fos.write(file.getBytes());
} catch (IOException e) {
Expand Down

0 comments on commit 45922e6

Please sign in to comment.