Skip to content

Unable to upload local image in Windows #61

@lukefan6

Description

@lukefan6

Let's say I have a local image file called my-code-doesnt-work.jpg alongside my markdown slide and I simply add it to the slide like this:

---
# Title

![](my-code-doesnt-work.jpg)
---

When I executed the converter, error message popped out as follows:

Unable to generate slides: { [Error: ENOENT: no such file or directory, open 'c:\c:\git\others\not-so-personal-notes\Stretch\slides\my-code-doesnt-work.jpg']

After some hacking I was able to pinpoint the cause to this line of code:
https://github.com/gsuitedevs/md2googleslides/blob/master/src/images/probe.ts#L62

I used console.log to print the parsedUrl.pathname and the result was

/c:/git/others/not-so-personal-notes/Stretch/slides/my-code-doesnt-work.jpg

Then it was passed to fs.createReadStream(path); and that's where the error came from.

I can hack it to resolve my issue by using fs.createReadStream(path.substring(1)); but obviously it's not an ideal solution and I have no idea whether it will affect macos / linux or not.

Any ideas?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions