asciidoctor-browser-extension icon indicating copy to clipboard operation
asciidoctor-browser-extension copied to clipboard

file fails to render if extension is not lowercase

Open kentkercher opened this issue 3 years ago • 6 comments

this should be case-insensitive, no? But, for example,

filename.ASC

will not render, while

filename.asc

will render.

kentkercher avatar Jun 16 '21 18:06 kentkercher

Apparently, matches is case-sensitive 😞

https://github.com/asciidoctor/asciidoctor-browser-extension/blob/2c1e96ee8043c3c28b5cd4fc8fc613d23867485c/app/manifest.json#L18-L49

According to https://stackoverflow.com/a/18143014/3600979 we would need to add every variation:

{
  "matches": [
    "*://*/*.asc",
    "*://*/*.Asc",
    "*://*/*.aSc",
    "*://*/*.asC",
    "*://*/*.ASc",
    "*://*/*.ASC",
    "*://*/*.aSC",
    "*://*/*.AsC",
    // ... and so on
  ]
}

Please note that the recommended file extension is adoc.

ggrossetie avatar Jun 16 '21 21:06 ggrossetie

I recommend against this change. A file extension is case sensitive, and the only official file extension for AsciiDoc moving forward is .adoc. That's what's going to be standardized. And it's going to be lowercase.

mojavelinux avatar Jun 16 '21 21:06 mojavelinux

A file extension can be case-sensitive, but with certain file system formats (e.g., the default Mac OS Extended (Journaled), which is broadly agnostic toward case; or the classic DOS 8.3 format, which is uppercase only), it very well might not be.

I used .ASC in the earlier example specifically for its compatibility with 8.3—yes, it's not the recommended .adoc extension, but it is 8.3-friendly.

kentkercher avatar Jun 16 '21 23:06 kentkercher

A file extension can be case-sensitive,

I was referring to the AsciiDoc file extension.

mojavelinux avatar Jun 16 '21 23:06 mojavelinux

So in cases where a workflow, like mine, requires that a document pass through:

  1. a DOS computer (and therefore have its name conformed to an uppercase 8.3 filename)
  2. a Mac computer (where the system doesn't really care if it's seeing a filename.asc or FILENAME.ASC or anything in-between)
  3. a Linux computer (where each variation would be seen as a completely different file)

...and bounce back and forth between those...

Would it not then make the most sense to allow some degree of case insensitivity—at the very least to allow a typical FILENAME.ASC (which all three systems would agree is the same file) to be readable by this browser extension?

kentkercher avatar Jun 16 '21 23:06 kentkercher

After giving it some thought, I don't think we should support uppercase file extension. As mentioned by Dan, the only official file extension for AsciiDoc moving forward is .adoc.

In other words, .asc (or in your case, .ASC) won't be officially supported moving forward. No matter what we do, sooner or later your workflow won't be supported.

I recommend using .adoc (for future compatibility) when you are working on mac or Linux computer. DOS is not a supported platform and as a consequence you will need to find a workaround if you want to pass an AsciiDoc document through this platform.

ggrossetie avatar Jun 20 '21 09:06 ggrossetie