-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
upload file failed if the path is "/" #3568
Comments
@yaojiqunaer : Thanks for reporting this. I can reproduce this issue. This issue can be fixed if we just assume directory to be - final String directory = file.substring(0, file.lastIndexOf('/'));
+ final String directory = file.substring(0, file.lastIndexOf('/')).isEmpty() ?
+ "/" :
+ file.substring(0, file.lastIndexOf('/')); I see you have an additional requirement for having an additional |
… path Pod file upload seems be be creating invalid exec command for upload if the file is directly in root path e.g. `/cp.log`. We create parent directory of file by creating a substring based on last index of `/`. This returns an empty string for a string like `/cp.log`. Assume directory path to be `/` when directory is returned as empty string. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
@yaojiqunaer : I've created #3721 for the enhancement you've requested |
… path Pod file upload seems be be creating invalid exec command for upload if the file is directly in root path e.g. `/cp.log`. We create parent directory of file by creating a substring based on last index of `/`. This returns an empty string for a string like `/cp.log`. Assume directory path to be `/` when directory is returned as empty string. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
… path Pod file upload seems be be creating invalid exec command for upload if the file is directly in root path e.g. `/cp.log`. We create parent directory of file by creating a substring based on last index of `/`. This returns an empty string for a string like `/cp.log`. Assume directory path to be `/` when directory is returned as empty string. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Pod file upload seems be be creating invalid exec command for upload if the file is directly in root path e.g. `/cp.log`. We create parent directory of file by creating a substring based on last index of `/`. This returns an empty string for a string like `/cp.log`. Assume directory path to be `/` when directory is returned as empty string. Signed-off-by: Rohan Kumar <rohaan@redhat.com>
Description
If my file is uploaded to the root path of the container like "/" it will give an error, like "/var" it will not
Dependency
My code
Exception
Reason maybe here
mehtod in io.fabric8.kubernetes.client.dsl.internal.uploadable.PodUpload#uploadFile
the substing reture "";
final String directory = file.substring(0, file.lastIndexOf('/'));
the directory is "" when file is "/xxx.xxx"
Other requirements
Upload method only support java.nio.file.Path as a local file path, if i use the org.springframework.web.multipart.MultipartFile uploaded files, are unable to get the file(getFile methord is forbit),so i must write multiPartFIle inputStrem to local disk and then read file as Path . Why not support both Path and InputStream?
The text was updated successfully, but these errors were encountered: