You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the detailed issue with a reproduction case 👍
I think that the file type cannot be resolved by the browser as soon as the file contains a NULL character.
In this case, the MIME type ends up being application/octet-stream and the browser decides to download it before the extension is even executed.
Resource interpreted as Document but transferred with MIME type application/octet-stream: "file:///C:/path/to/NULL_character_example.adoc".
As a workaround, you can check the "Preview files with txt extension" in the options:
With this setting, the browser resolves the MIME type to text/plain (because txt is a well-known extension) and decides to open it (not download it).
As far as I know there's nothing we can do in the extension to change this behavior.
Having said that, the AsciiDoc working group plans to register adoc as an official file extension (with text/asciidoc as a MIME-type). See: asciidoctor/asciidoctor#2502
If we do that then browsers will eventually recognize the .adoc file extension and open the content (even if it contains a NULL-character) because this file extension is associated to a textual format (just like .txt).
But it won't happen overnight so you should consider the workaround described above 😉
For reference, I can also reproduce this behavior in Firefox and Edge (Chromium).
I've added the label "upstream" since I do think that the only way to fix this issue is to register adoc as an official file extension.
Local file is downloaded by Chrome instead of being displayed when file contains "NULL" character, i.e. a character which HEX-code is 00
The description looks like #323 , but looking throw it I'd suppose that this is another case.
The system is Windows 10, browser - Chrome 83.0.4103.106 64bit, Asciidoctor extension - 2.6.1
The text was updated successfully, but these errors were encountered: