voila icon indicating copy to clipboard operation
voila copied to clipboard

Expose dir content to the VoilaHandler template

Open martinRenou opened this issue 5 years ago • 8 comments

This allows one to make a voila template with a tree view of the current directory:

This should fix #197

voila_tree

As discussed with @maartenbreddels, there might be better ways of doing this.

martinRenou avatar Jun 06 '19 12:06 martinRenou

I need to think on whether it is an issue to expose the content of the current directory.

SylvainCorlay avatar Jun 06 '19 19:06 SylvainCorlay

Grumbles.

SylvainCorlay avatar Jun 06 '19 19:06 SylvainCorlay

Yes indeed, it does pose a security issue. If a single notebook is shown, the content should not be exposed. We were setting up testing for this.

maartenbreddels avatar Jun 06 '19 20:06 maartenbreddels

Yes. I'm removing the gridstack dependency in the tests and activating the appveyor tests before.

martinRenou avatar Jun 07 '19 13:06 martinRenou

Love the sidebar idea. Could you achieve the same effect with a tree template instead? The notebook could be in an iframe or loaded with jquery or something.

jeffyjefflabs avatar Jun 12 '19 02:06 jeffyjefflabs

@jeffyjefflabs If we go for the "Only one handler" idea it will be possible to do it properly with a template :)

And for answering your question, I think you cannot achieve it with the tree template right now, because you would not know which notebook to display

martinRenou avatar Jun 12 '19 09:06 martinRenou

I need to think on whether it is an issue to expose the content of the current directory.

Yes indeed, it does pose a security issue. If a single notebook is shown, the content should not be exposed. We were setting up testing for this.

Thinking more about it. I think it is not a security issue. It only exposes the directory content to the Jinja template. The default template does not use it.

Only if you use a custom template that makes use of this variable you will see the directory content. But that is completely up to the template developer.

martinRenou avatar Jan 27 '20 17:01 martinRenou

I'd still like to see this land in the handler, but it would preferably use the same code as in treehandler.py (the allowed_content function).

maartenbreddels avatar Aug 18 '20 08:08 maartenbreddels