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
fix #11625: sanitize invalidly named FS paths #2909
Conversation
basePath = basePath.transform(sanitizer); | ||
int index = paths.size(); | ||
while (--index >= 0) { | ||
paths.set(index, paths.get(index).transform(sanitizer)); | ||
} |
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 wondered if there was some nice Guava way to transform the elements of a collection (map (map f) ...
) but I don't easily see one.
Relaunched on 247. In general, patch seems like quite the easy fix. We likely have zero integration tests running on Windows so manual testing will be necessary. |
Conflicting PR. Removed from build OME-5.1-merge-push#371. See the console output for more details. |
Conflicting PR. Removed from build OME-5.1-merge-push#372. See the console output for more details. |
…-sanitize-file-paths
If it helps any with testing the sanitization: One could hack |
In the final ClientFilePathTransformer sanitizer = new ClientFilePathTransformer(new Function<String, String>() {
public String apply(String string) {
return string;
}
}); Then I used Insight and tried importing a file named Are there any other test cases I should try out? If not, then I'd presume this is good to merge. |
Looks good, thank you. |
Conflicting PR. Removed from build OME-5.1-merge-push#375. See the console output for more details. |
Conflicting PR. Removed from build OME-5.1-merge-push#376. See the console output for more details. |
…-sanitize-file-paths
Please kick travis for me. |
Need to re-test this PR after merging in develop? |
Patch still looks quite simple and straight-forward, so no worries here. One question though: @bpindelski, did your testing occur on Windows? |
@joshmoore No, the test was done on OS X. |
If I can be so rude, I really think this there needs to be some cross testing, though if @pwalczysko prefers to do that via a different build, we an merge and list this elsewhere. We simply don't have anything that does:
/cc @sbesson |
@joshmoore I can test this PR again tomorrow, as currently I don't have a Windows VM handy. Unless Petr beats me to it. |
Which client/server combinations suffice? (Perhaps just Windows client to Unix server?) Also, should the cross-testing include @bpindelski's hack from #2909 (comment) in the client? |
Well, I am not sure what is this about, but in a hope this would help I took a Windows Insight and imported some images into trout. It went fine. |
Conflicting PR. Removed from build OME-5.1-merge-push#377. See the console output for more details. |
Conflicting PR. Removed from build OME-5.1-merge-push#378. See the console output for more details. |
Conflicting PR. Removed from build OME-5.1-merge-push#381. See the console output for more details. |
…-sanitize-file-paths
@joshmoore is mostly worred about how |
@bpindelski kindly determined that this PR's conflict is with #2884. |
Notes:
|
💯 for the testing, @bpindelski! |
…-sanitize-file-paths Conflicts: components/blitz/src/ome/services/blitz/repo/ManagedRepositoryI.java
The last commit doesn't change anything on the code-path of file name sanitisation, so this is good to merge. |
fix #11625: sanitize invalidly named FS paths
Fixes http://trac.openmicroscopy.org.uk/ome/ticket/11625 by partially reverting mtbc@34748dd. Now Python clients should be able to set
FilesetEntry.clientPath
to a/
-separated but otherwise-hairy path (e.g.,"/".join(dir.splitall())
) and have the server fix the path at import time so as to sanitize it according to http://www.openmicroscopy.org/site/support/omero5.1-staging/sysadmins/fs-upload-configuration.html#legal-file-names. (ImportLibrary.createImport
hasImportContainer.fillData
do path sanitization but clients may import by other means.) TheFilePathNamingValidator
class, though now unused, may yet have further use and is very lovely, so remains in the codebase.--no-rebase