-
-
Save sebastienvermeille/7dd82a79e5255c25c775895b922823e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Mono<Blob> save(final FilePart filePart) { | |
final var storageUUID = UUID.randomUUID(); | |
final var uploadDir = new File(UPLOAD_DIR + storageUUID); | |
return filePart.transferTo(uploadDir).flatMap(unused -> { | |
final var blobb = Blob.builder() | |
.uuid(storageUUID) | |
.originalFileName(filePart.filename()) | |
.extension(getExtension(filePart.filename()).orElse(null)) | |
.build(); | |
return blobRepository.save(blobb); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment