Marcelh1983 / document-viewer

MIT License
50 stars 25 forks source link

Error at initial rendering #27

Closed PedroAmadorITS closed 2 years ago

PedroAmadorITS commented 2 years ago

Hello, I have the following issue when rendering the viewer at unit testing. image

That line that I have pointed out has the issue, I think a simple null validator should do it: const u = url?.indexOf('/') ? encodeURIComponent(url) : url;

Since url is undefined, it throw the following error: image

What I have tried so far:

image

This does not affect the prod build, the condition works properly once deployed, but this intermittent error is crashing my CI/CD pipelines when unit testing, and sometimes works nice, others, the pipeline crashes for the same cause.

I will appreciate your help on this. Regards!

Marcelh1983 commented 2 years ago

Sorry for the late response and thanks for the feedback and clear description! Could you do a pull request? Then I'll merge it as soon as possible and release a new version

PedroAmadorITS commented 2 years ago

Hey there!

Sure, I'll create my branch and submit a PR as soon as possible.

Regards!

PedroAmadorITS commented 2 years ago

Issue resolved, thanks for the valuable help @Marcelh1983

Regards!