Accessing local files and folders / open with explorer?
-
@schajuli look in the developer tools to see what HTML is being emitted. I'd guess it's being sanitized out.
-
Ok, while it seems to be working with Chrome it does not with Firefox
Tried out the following and I am still having the same issues within nodeBB
https://stackoverflow.com/questions/1804604/firefox-open-local-link-to-directory-with-explorerAll links starting with file///: are getting truncated meaning that they are not recognized by the browser anymore. Is there a way to bypass this?
Moreover what I do not understand is that the concept itself is failing as in a plain test html for both browsers the link works, but in nodebb it does not for Firefox, though the link in the sourcecode of the pages in the end is absolutely the same ...
<a href="\\C:\Program Files">This should work</a>
-
What is the exact markdown you're inputting and what is the HTML you see on the resulting page?
-
Well,
actually the following works in plain HTML in both Chrome and Firefox:
<a href="file:///C:\Program Files">Opens Explorer (for both but not in NodeBB)</a>
-> but it does not work within NodeBB
So what e.g. works now within NodeBB (but only in Chrome) is ...
<a href="\\C:\Program Files">This only works with Chrome in nodeBB</a>
... although it also works with Firefox in plain HTML so that was what I wrote in the previous post.
So what's in the source code of the post then:
For the first one it seems like it's sanitized as this removes the href totally ...
so
but the second is a real link ...
... but Firefox refuses to open it although it does in plain html
-
My guess is that any non-http(s) links are being sanitized out for safety. This is likely done by the markdown parser (or perhaps from the markdown plugin).
Enabling HTML and pasting in HTML directly bypasses the markdown plugin, so that is why it doesn't get sanitized out, but it sounds like there's some other quirk that's causing it to render oddly (in such a way that only Chrome can open it).
-
@julian actually it looks like he has tried it with just HTML and it appears that it's actually the built in NodeBB sanitizer.
I'm guessing
\\
works in Firefox when it's from an actual HTML file is because Firefox doesn't protect local files from local access but does prevent that from web access. And Chrome just doesn't have that restriction. -
@julian said in Accessing local files and folders / open with explorer?:
Right. Either way the question is whether we really should be allowing NodeBB to link out to local files. I suppose there isn't any harm in it...
At least to have an option allowing that would be great if that would mean that it should work!
Edit: Also played a bit with the ns-embedd plugin and tried to automatically create a button when local links are posted but it seems like that those links are going to be sanitized as well - not just local links but all of them.
-
Any news on this and how to make it possible?
Especially as this https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows would allow me to do what I want but if if I register a new file handler but NodeBB seems to sanitize everything as I can't make use of new file handlers as I simply can't click the links.
(I am not on the latest release if this is a relevant information ...)
Edit: Ok, managed to write me a chrome plugin that allows me to exchange the "file:///" directly on the client side, which kind of works (though it still opens the index file in the background ... not sure where to change/deactivate that)
Anybody knows that or maybe there is a better way to achieve what I want by using custom javascript in the admin panel?
(Probably there is a way to avoid that myfilehandler:/// .... is getting sanitized?Edit2: @PitaJ I think it would be the best way to make it work on all browsers (after I have registered myfilehandler on client side....)
Any chance that I can change this anywhere by a code modification or with a plugin on my side? I think the initial sanitize plugin is now part of the core built so might it be possible to change it somewhere in the config files?