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

Error when only single url passed to create() #157

Open
mb-shirtigo opened this issue May 9, 2020 · 1 comment
Open

Error when only single url passed to create() #157

mb-shirtigo opened this issue May 9, 2020 · 1 comment

Comments

@mb-shirtigo
Copy link

Hey,

we get a chdir error, when the array contains only one url.
With two or more the zip file is generated without any problems.

Error: Alchemy\Zippy\Exception\RuntimeException: Unable to chdir to https://www.google.de/images/branding/googlelogo/2x

NOT WORKING:
$file = ['https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'];
$archiveZip = $zippy->create('archive.zip', $file, false);

WORKING:
$file =['https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png','https://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'];
$archiveZip = $zippy->create('archive.zip', $file, false);

Any help is appreciated.

Kind regards
Michael

@chriskonnertz
Copy link

chriskonnertz commented Sep 2, 2020

Hello,

I investigated and the error seems to be caused by this line of code:
return isset($data['path']);
https://github.com/alchemy-fr/Zippy/blob/master/src/Resource/Resource.php#L114

Even for a path that is without any doubt NOT local the path index will be set.
(You can test this here: http://sandbox.onlinephpfunctions.com/code/29fbfd20b141347ec613740ab7b7b039c95cec1a )

parse_url() does not seem to be the right choice here.
I guess the most basic approach would be to check if the path contains "://".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants