-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows saving of files to filesystem #312
Conversation
a601eab
to
2cf6f98
Compare
2cf6f98
to
0aaacfb
Compare
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Few questions on validation of fileName, see comments
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
Can we include file content validation (is this actually an image...) here or is this sth. for another day? |
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
We do contentType validation. I don't know if content validation adds more security/functionality and if its even doable with an acceptable effort. |
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Show resolved
Hide resolved
Thanks for e55e17e, I do not know The easiest thing would surely be to have this being configurable, whether this validation should happen. And probably also being easily able to plug in a common project validation. This all might e out of scope if this issue. Please proceed as you like, either including the (configurable) validation or by letting it out. My 2 ¢ |
shogun-config/src/main/java/de/terrestris/shogun/properties/UploadProperties.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/FileService.java
Outdated
Show resolved
Hide resolved
Another general question: Will this scale well? I still remember that filesystems and containerized systems aren't the best friends. Is the behavior configurable, where the actual file ends up (database, filesystem)? |
shogun-lib/src/main/java/de/terrestris/shogun/lib/util/FileUtil.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/BaseFileController.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Show resolved
Hide resolved
Co-authored-by: Daniel Koch <koch@terrestris.de> Co-authored-by: André Henn <henn@terrestris.de>
26e403c
to
051a311
Compare
e488084
to
5c0c3a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Outdated
Show resolved
Hide resolved
shogun-lib/src/main/java/de/terrestris/shogun/lib/service/ImageFileService.java
Show resolved
Hide resolved
shogun-lib/src/test/java/de/terrestris/shogun/lib/service/BaseFileServiceTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Daniel Koch <koch@terrestris.de>
This introduces interfaces and methods to upload files to the filesystem instead of adding them as bytearray to the DB.
path
property to theFile
entity.UploadProperties
path
--> The basePath of the upload directorymaxSize
--> The maximum size of upload (currently not used)BREAKING CHANGE:
Removes-> see Readd method validateFile including a note about deprecation #316validateFile
from theFileUtil
and moved validation to theBaseFileService