Skip to content
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

Can't move uploaded file to root of a protocol #28680

Closed
jackbentley opened this Issue Oct 2, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@jackbentley
Copy link

commented Oct 2, 2018

Symfony version(s) affected:
2.8.*|3|4?

Description
We have setup custom protocols using Flysystem. We tried to move an uploaded file to the protocol by using the built in symfony methods. Unfortunately, the two slashses for the protocol get cut down to a single slash which breaks.

Caused by

$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));

How to reproduce
Upload a file and, in a controller, try to move it like so:

$upload->move('cutstom-protocol://', 'filename.txt');
// resolves `custom-protocol://` to `custom-protocol:/`

Possible Solution
Current work around is to add ./ on to the end of the protocol. However, I'm unsure how well this would be handled for othe Flysystem adapters and custom protocols that don't write directly to the local filesystem.

custom-protocol://./

Ideally, this case should be handled. Maybe check to see if the first and last occurance of a slash are equal to ://?

@fabpot

This comment has been minimized.

Copy link
Member

commented Oct 10, 2018

@jackbentley Want to work on a fix?

@Deuchnord

This comment has been minimized.

Copy link

commented Apr 7, 2019

Taking this for EUFOSSA Hackaton :)

@Deuchnord

This comment has been minimized.

Copy link

commented Apr 7, 2019

Could you please provide a reproducer for this?

@xabbuh

This comment has been minimized.

Copy link
Member

commented Apr 18, 2019

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this Apr 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.