Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Autodetection of text/plain markdown files not working #21

Open
tkapias opened this issue Oct 2, 2024 · 2 comments
Open

[Bug] Autodetection of text/plain markdown files not working #21

tkapias opened this issue Oct 2, 2024 · 2 comments

Comments

@tkapias
Copy link

tkapias commented Oct 2, 2024

The issue

I checked Autodetection in Enlight, but the extension does not start by itself for markdown files even if the header was forced as text/plain.

Manually it works good, even Auto-Detect.

Context

I use Dufs file server and I forced nginx to rewrite content-type headers for .md files to text/plain; charset=UTF-8.

  • File server: Dufs
  • Nginx Proxy: nginx 1.18
  • Firefox: 115.15.0esr
  • Enlight: 2.7.11.0

On Firefox, the file opens inline as a text/plain with this header (same as with curl --include):

HTTP/2 200 OK
server: nginx/1.18.0
date: Wed, 02 Oct 2024 06:57:30 GMT
content-length: 11783
last-modified: Wed, 02 Oct 2024 04:31:32 GMT
etag: "1727843492695-11783"
content-disposition: inline; filename="readme.md"
accept-ranges: bytes
content-type: text/plain; charset=UTF-8
X-Firefox-Spdy: h2

I also tried without forcing charset=UTF-8.

@Qeole
Copy link
Owner

Qeole commented Oct 7, 2024

Thanks for the report! Would you have a Markdown file available somewhere, so I can reproduce, by any chance? Firefox tries to download and save the files when I host them on my own server, and I'd as well avoid playing with the nginx configuration if I could.

@Qeole
Copy link
Owner

Qeole commented Oct 7, 2024

My guess would be that forcing text/plain prevents Firefox from applying basic HTML mark-up to the text document? (To be confirmed). And that in that case, function checkBody() in the add-on would fail to find a PRE block, for example, and return false, thus blocking auto-detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants