Some .gmi files are displayed as plain text on my page #223

Closed
opened 2023-02-16 01:36:39 +00:00 by alexlehm · 12 comments

I have started a gemlog page on my site and for some reason Bombadillo is showing the post files as plain text while it displays all regular pages as gemini text. This happens with two different servers with the same content, I am not sure if that is a server error or a client error, it works with e.g. Lagrange or the Gemini web proxies but it does not work with Amfora either.

I have started a gemlog page on my site and for some reason Bombadillo is showing the post files as plain text while it displays all regular pages as gemini text. This happens with two different servers with the same content, I am not sure if that is a server error or a client error, it works with e.g. Lagrange or the Gemini web proxies but it does not work with Amfora either.
Author

my page is at gemini://alexlehm.pollux.casa/

my page is at gemini://alexlehm.pollux.casa/
Owner

I have no problems loading the given address as text/gemini in the current version of bombadillo.

What version are you running? There are two ways to find out:

  1. At your shell prompt enter: bombadillo -v
  2. In bombadillo use the command :version

In general bombadillo will only render a gmi file as gemtext if the status code from the server indicates a mime type of text/gemini. If anything other than that is sent by the server, bombadillo will render the file as plain text (unless it is an image: png or jpg; in which case it will attempt to render the image in braille characters).

Let me know what you find :)

I have no problems loading the given address as `text/gemini` in the current version of bombadillo. What version are you running? There are two ways to find out: 1. At your shell prompt enter: `bombadillo -v` 2. In bombadillo use the command `:version` In general bombadillo will only render a gmi file as gemtext if the status code from the server indicates a mime type of `text/gemini`. If anything other than that is sent by the server, bombadillo will render the file as plain text (unless it is an image: png or jpg; in which case it will attempt to render the image in braille characters). Let me know what you find :)
Author

I believe the server sends text/gemini (when I run a cli request, I get text/gemini lang=en)

I use Bombadillo version: 2.3.3 (in fact I run that on rawtext.club since I just joined the site)

I believe the server sends text/gemini (when I run a cli request, I get text/gemini lang=en) I use Bombadillo version: 2.3.3 (in fact I run that on rawtext.club since I just joined the site)
Author

This url does not work for me:

gemini://alexlehm.pollux.casa:1965/gemlog/2023-Feb-12.gmi

This url does not work for me: gemini://alexlehm.pollux.casa:1965/gemlog/2023-Feb-12.gmi
Author

I probably have messed something up with the files but I am not getting what

I probably have messed something up with the files but I am not getting what
Author

The mime type looks ok:

$ ./gemini-request.sh -h alexlehm.pollux.casa /gemlog/2023-Feb-12.gmi 2>/dev/null|head
20 text/gemini; lang=en
# Sun, 12 Feb 2023 23:43:40 +0000

<p>World Community Grid says in their newsletter that I have not returned a result for 8 years, that is probably because I decided that it uses too much CPU to run it,maybe I should start again</p>

# Sun, 12 Feb 2023 20:26:32 +0000

<p>I wonder how long I am using unix and I never get the access bits right (chmod 666 instead of chmod 777)</p>

# Sun, 12 Feb 2023 20:04:02 +0000
The mime type looks ok: ``` $ ./gemini-request.sh -h alexlehm.pollux.casa /gemlog/2023-Feb-12.gmi 2>/dev/null|head 20 text/gemini; lang=en # Sun, 12 Feb 2023 23:43:40 +0000 <p>World Community Grid says in their newsletter that I have not returned a result for 8 years, that is probably because I decided that it uses too much CPU to run it,maybe I should start again</p> # Sun, 12 Feb 2023 20:26:32 +0000 <p>I wonder how long I am using unix and I never get the access bits right (chmod 666 instead of chmod 777)</p> # Sun, 12 Feb 2023 20:04:02 +0000 ```
Owner

It is rendering fine as gemtext. But gemtext is not html. You have put a bunch of html into your gemtext. So if you are expecting <p> and <a href="...">...</a> tags to render... that wont happen in a gemtext document. You need to use the gemtext format. Here is an introduction to gemtext.

It is rendering fine as gemtext. But gemtext is not html. You have put a bunch of html into your gemtext. So if you are expecting `<p>` and `<a href="...">...</a>` tags to render... that wont happen in a gemtext document. You need to use the gemtext format. Here is [an introduction to gemtext](https://gemini.circumlunar.space/docs/gemtext.gmi).
Owner

You are certainly welcome to serve html over the gemini protocol. But most clients wont render it as html and will just display it as text/plain. The reason some other browsers displayed your file the way you expected it is because they are using a web renderer for their gemini client. As such, they are converting gemtext to html and then rendering. Since you are already using html in your gemtext it just rendered... because they are not escaping html in the gemtext content. This is actually something that can potentially allow javascript injection attacks, to a certain degree. What clients displayed your links and p tags the way you expected them? I'm happy to reach out to those developers and let them know about the security vulnerability.

You are certainly welcome to serve html over the gemini protocol. But most clients wont render it as html and will just display it as `text/plain`. The reason some other browsers displayed your file the way you expected it is because they are using a web renderer for their gemini client. As such, they are converting gemtext to html and then rendering. Since you are already using html in your gemtext it just rendered... because they are not escaping html in the gemtext content. This is actually something that can potentially allow javascript injection attacks, to a certain degree. What clients displayed your links and p tags the way you expected them? I'm happy to reach out to those developers and let them know about the security vulnerability.
Author

It is not rendering the sections with the dates either. the

tags come from my converter script, that is not a good example.

Currently in bombadillo it looks like this:

image

Lagrange does not render the p tags either, but it displays the date entries

image

It is not rendering the sections with the dates either. the <p> tags come from my converter script, that is not a good example. Currently in bombadillo it looks like this: ![image](/attachments/2691d0eb-3664-463a-b5c3-f5e9f40d4a2a) Lagrange does not render the p tags either, but it displays the date entries ![image](/attachments/c3ed7153-36c2-4b6e-902b-f106e4d7c625)
Author

I think I found what my thinking error is, the tty client does not render headings and displays # headling instead while the graphical client uses a larger font. Then it is completely correct and I just have to clean up the HTML to convert it to gemtext properly

I think I found what my thinking error is, the tty client does not render headings and displays # headling instead while the graphical client uses a larger font. Then it is completely correct and I just have to clean up the HTML to convert it to gemtext properly
Owner

Ah. yes! Bombadillo just displays the heading level (I think it may bold a top level heading, but I cannot remember) withe # char since the tty cannot display in variable font sizes.

Good to hear that Lagrange is not rendering the P tags either.

Ah. yes! Bombadillo just displays the heading level (I think it may bold a top level heading, but I cannot remember) withe `#` char since the tty cannot display in variable font sizes. Good to hear that Lagrange is not rendering the P tags either.
Author

I am working on converting the html tags to gemtext now

I am working on converting the html tags to gemtext now
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#223
No description provided.