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

Unable to load file on Windows #72

Closed
jindrazak opened this issue Feb 2, 2020 · 11 comments · Fixed by #83
Closed

Unable to load file on Windows #72

jindrazak opened this issue Feb 2, 2020 · 11 comments · Fixed by #83

Comments

@jindrazak
Copy link

I am facing trouble exporting svg to png on Windows.

Way to reproduce:

Powershell:

> npm i svgexport -g
... OK
> svgexport.cmd .\inputimage.svg outputimage.png
Error: Unable to load file (Error: net::ERR_INVALID_URL at file://C:%5CUsers%5Cjindr%5Cinputimage.svg): C:\Users\jindr\inputimage.svg
@jefago
Copy link

jefago commented Feb 8, 2020

I have the same issue. Works with 0.3.2, stopped working with 0.4.0.

@jefago
Copy link

jefago commented Feb 8, 2020

The problem is here: https://github.com/shakiba/svgexport/blob/master/render.js#L30

On Windows, svgfile will be something like C:\users\...., so the URL that gets created is file://C:\users\..., but it should be file:///C:/users/ (three forward slashes, backslashes replaced by forward slashes although I'm not certain the latter is needed).

@MichaelRoosz
Copy link
Collaborator

Yes, I have already prepared a fix for Windows. There is still another Windows bug to be fixed, once this is done we can release a new version.

@roman-petrov
Copy link

@MichaelHeerklotz , any chance to make the latest version work on Windows soon? :)

@MichaelRoosz
Copy link
Collaborator

@roman-petrov I am aiming for a release this week. Sorry for taking so long.

@roman-petrov
Copy link

@MichaelHeerklotz , sounds great! Thank you!

@liuchaobit
Copy link

I have the same problem
where can I find the latest version

@ctch3ng
Copy link

ctch3ng commented May 9, 2020

For Windows users, in %AppData%\npm\node_modules\svgexport\render.js

Change the line

await page.goto('file://' + encodeURI(svgfile))

into

await page.goto('file:///' + encodeURI(svgfile).replace(new RegExp(/%5C/g),"/"))

@jindrazak
Copy link
Author

jindrazak commented May 9, 2020

@ctch3ng Wouldn't it be better to apply a pull request?

@jamesmontalvo3
Copy link
Contributor

Submitted #83. Resolved issues on Windows for me. Haven't tested on other systems.

@silverwind
Copy link

Alternative PR: #86

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

Successfully merging a pull request may close this issue.

8 participants