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

Bug - The output file scheme is not supported. #512

Open
vladutt opened this issue Sep 7, 2023 · 8 comments
Open

Bug - The output file scheme is not supported. #512

vladutt opened this issue Sep 7, 2023 · 8 comments

Comments

@vladutt
Copy link

vladutt commented Sep 7, 2023

Hello.
On version 1.4.3 of knplabs/knp-snappy we got this error.

The output file scheme is not supported. Expected '' or 'file' but got 'c.

The solution was to change the version back to 1.4.1

Also we tried to update version of laravel-snappy as well to 1 from 0.4.8, but without any results.

Server: Windows IIS
PHP: 8.1.13

@mfzpeyo
Copy link

mfzpeyo commented Sep 12, 2023

Knp\Snappy\AbstractGenerator.php Line: 629

Generated file name C:\Windows\Temp\test.html

array:2 [▼ // routes\ext.routes\dev.php:12
  "scheme" => "C"
  "path" => "\Windows\Temp_est.html"
]
protected function prepareOutput($filename, $overwrite)
 {
     if (false === $parsedFilename = \parse_url($filename)) {
         throw new InvalidArgumentException('The output filename is invalid.');
     }

     $scheme = isset($parsedFilename['scheme']) ? \mb_strtolower($parsedFilename['scheme']) : '';

@nepos87
Copy link

nepos87 commented Sep 12, 2023

Same bug with 1.4.8 version and PHP: 7.4

Any solution?

@nepos87
Copy link

nepos87 commented Sep 12, 2023

Tested with all versions of 0.4.* and get the same error

@vladutt
Copy link
Author

vladutt commented Sep 12, 2023

Tested with all versions of 0.4.* and get the same error

on 1.4.1 can't be the same error. Because the code which check schema it's not present. Test carefully what version did you installed. Maybe you can try to delete vendor and composer-lock.json.

In your composer the package should be without '^'. like this
"knplabs/knp-snappy": "1.4.1",

@KleinDevDE
Copy link

KleinDevDE commented Sep 12, 2023

I have the same problem.
However, the bug itself belongs to KnpLabs/snappy and not barryvdh/laravel-snappy.
See: KnpLabs/snappy#489

A bug fix is already in the works and will be in the next release.
The last version took 6 months, so I can't say when this will happen.

Workaround

So here is a workaround that works just as well.
Add the following line to your composer.json require block:
"knplabs/knp-snappy": "1.4.2 as 1.4.3".
This will map version 1.4.3 to version 1.4.2.

After that, you need to do one of the following things:

  • Delete the file `composer.lock
  • Run composer update
  • Run composer update knplabs/knp-snappy -- The best option

@alexpozzi
Copy link
Contributor

alexpozzi commented Sep 13, 2023

I should be able to release a fix this week.
The fix is ready and it's waiting for couple more reviews KnpLabs/snappy#490
Feel free to review it yourself, sorry for the issue.

@alexpozzi
Copy link
Contributor

Fix released, I've added a test pipeline for Windows to avoid OS related issues to happen again.

@nepos87
Copy link

nepos87 commented Sep 14, 2023

It works now, thanks!

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

5 participants