Static directory listing causes registry crash
Hi, I can access my image via: http://localhost:3030/my-component/0.0.1/static/img/logo.png
But when I goto http://localhost:3030/my-component/0.0.1/static/img/ registry crashing and I am getting following error from the cli:
events.js:165
throw er; // Unhandled 'error' event
^
Error: EISDIR: illegal operation on a directory, read
Emitted 'error' event at:
at fs.read (fs.js:2116:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:673:17)
Thanks for reporting this @siluet What platform are you using? Operating system, oc version and node version?
Hi Matteo, I am running node on a macos sierra, and versions are below: node -v v9.11.1 oc --version 0.44.11
Thanks, I did some digging and I think the bug is here: https://github.com/opencomponents/oc/blob/master/src/registry/routes/static-redirector.js#L45-L50
First we check if the path exists (and in case of folder, it does), but then we assume it's a file and the createReadStream obviously fails. We should probably just check if it's a dir and in case return an error (a 403?)
Would you like to attempt a Pull Request for the fix, or want me to fix it?
Thanks
Hi Matteo, If I have rights to push, I can create a pull request for this.
Thank you.
@siluet no problem, you can do a Fork, make all the changes you need, and then make a Pull Request from there: https://help.github.com/articles/creating-a-pull-request-from-a-fork/ 👍