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
implement generic file accessor class #870
base: master
Are you sure you want to change the base?
Conversation
@andygrunwald : Would appreciate your feedback on the general design and how that works based on the example file changed |
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.
I am not 100% sure about the design of the class. Or lets say, purpose of the class.
Is the main purpose to represent one single file? Or is the purpose to enable Lansuite to initiate a File() instance once and handle multiple files?
From the name of the class, my first thought would be to handle one single file. If we loop over multiple files, for each file, a File()
instance would be created.
In this case, I suggest
- to add the file path for the constructor as a first parameter
- to remove the argument from functions like
getFullPath
andexists
, because the class only handles one file
In this case, it would also make sense to make a "delete" and "output" method.
LanSuite can still provide a helper function like "NewFile()" which sets the filesystem injection and root path.
Overall, I think we should do this, because we have multiple places where we deal with files.
If you think this is useful, I can also iterate over it a bit if you want :)
HI @andygrunwald , thanks for the helfpul feedback. Basically this was inteded as helper class for all file access operations. I am pondering whether addidng direct access methods like I was close to naming the Class |
What do you think about a pure Object Oriented approach here?
|
removed unnecessary if-case Co-authored-by: Andy Grunwald <andygrunwald@gmail.com>
#worksforme ;) Was mentally already halfway there, your idea of using an array of files for initialisation for FileCollection makes a ton of sense. |
This is true. Still, I would shim them away from the actual implementation and create a LanSuite File class as a Wrapper. This way we can exchange the lib as we want, without doing a big rewrite. |
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Start of replacement of file upload for picgallery + direct implementation of multifile upload to fix #1074
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
What is this PR doing?
WIP Implementation of a secure file accessor that makes working with files and folders easier while simultaneously preventing directory traversal both below LS root and any set intermediate path.
All current file accesses to be replaced with this
Which issue(s) this PR fixes:
no issue created
refs #710
Checklist
CHANGELOG.md
entry