README.org casuing 500 internal server error #12403

Closed
opened 2025-11-02 10:08:44 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @arifer612 on GitHub (Jan 29, 2024).

Originally assigned to: @KN4CK3R on GitHub.

Description

[[file:]] Org links are causing 500 internal server errors (similar to #17139):

An error occurred:

Render, orgmode.Render failed: could not write output: interface conversion: org.Node is org.Text, not org.RegularLink

The culprit lies in Org file: links, e.g., GPLv3 Badge][file:https://img.shields.io/badge/license-GPL_3-green.svg. This should show a GPLv3 badge, but instead triggers the error. Although omitting the file: still achieves the intended result without an error, it should be noted that this works just fine on GitHub and in the previous version of Gitea, i.e., v1.21.3.

P.S. Gitea demo site reproduction was not possible as I could not even log into the demo site.

Gitea Version

1.21.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/arifer612/2baa4b54e00392e0d7f0238a2344450f

Screenshots

Screenshot from 2024-01-29 21-26-08

Git Version

2.40.1

Operating System

unRAID

How are you running Gitea?

Run as a Docker container.

Database

MySQL/MariaDB

Originally created by @arifer612 on GitHub (Jan 29, 2024). Originally assigned to: @KN4CK3R on GitHub. ### Description `[[file:]]` Org links are causing 500 internal server errors (similar to #17139): ``` An error occurred: Render, orgmode.Render failed: could not write output: interface conversion: org.Node is org.Text, not org.RegularLink ``` The culprit lies in Org `file:` links, e.g., [[GPLv3 Badge][file:https://img.shields.io/badge/license-GPL_3-green.svg]]. This should show a GPLv3 badge, but instead triggers the error. Although omitting the `file:` still achieves the intended result without an error, it should be noted that this works just fine on GitHub and in the previous version of Gitea, i.e., v1.21.3. P.S. Gitea demo site reproduction was not possible as I could not even log into the demo site. ### Gitea Version 1.21.4 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist https://gist.github.com/arifer612/2baa4b54e00392e0d7f0238a2344450f ### Screenshots ![Screenshot from 2024-01-29 21-26-08](https://github.com/go-gitea/gitea/assets/46054733/e6d054fb-4727-4165-8d82-0ee3072030f2) ### Git Version 2.40.1 ### Operating System unRAID ### How are you running Gitea? Run as a Docker container. ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:08:44 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Feb 2, 2024):

I think the fix could be like this: Fix orgmode link resolving #29024

ps: your content ([[GPLv3 Badge][file:https://...]])seems not matching orgmode syntax: https://orgmode.org/org.html#Link-Format-1 , the format is [[LINK][DESCRIPTION]], so maybe you would like to use [[file:https://...][GPLv3 Badge]] or [[file:https://...][file:https://...]] instead?

@wxiaoguang commented on GitHub (Feb 2, 2024): I think the fix could be like this: Fix orgmode link resolving #29024 ps: your content (`[[GPLv3 Badge][file:https://...]]`)seems not matching orgmode syntax: https://orgmode.org/org.html#Link-Format-1 , the format is `[[LINK][DESCRIPTION]]`, so maybe you would like to use `[[file:https://...][GPLv3 Badge]]` or `[[file:https://...][file:https://...]]` instead?
Author
Owner

@wxiaoguang commented on GitHub (Feb 2, 2024):

@KN4CK3R sorry I didn't notice that this issue has been assigned to you. If you have been working on this and/or have other approaches, I will close my PR. 🙏

@wxiaoguang commented on GitHub (Feb 2, 2024): @KN4CK3R sorry I didn't notice that this issue has been assigned to you. If you have been working on this and/or have other approaches, I will close my PR. 🙏
Author
Owner

@arifer612 commented on GitHub (Feb 2, 2024):

ps: your content ([[GPLv3 Badge][file:https://...]])seems not matching orgmode syntax: https://orgmode.org/org.html#Link-Format-1 , the format is [[LINK][DESCRIPTION]], so maybe you would like to use [[file:https://...][GPLv3 Badge]] or [[file:https://...][file:https://...]] instead?

Hi, the syntax is actually as intended.

Org interprets whatever is in the DESCRIPTION field as what should be displayed to the user, and whatever is in the LINK field as the target when clicked on. In this, case, we want to display an image at https://..., so that goes into the DESCRIPTION field; and say for example if we want the user to be directed to the LICENSE file, that's what goes into the LINK field. You can refer to an example repository here that does just this.

@arifer612 commented on GitHub (Feb 2, 2024): > ps: your content (`[[GPLv3 Badge][file:https://...]]`)seems not matching orgmode syntax: https://orgmode.org/org.html#Link-Format-1 , the format is `[[LINK][DESCRIPTION]]`, so maybe you would like to use `[[file:https://...][GPLv3 Badge]]` or `[[file:https://...][file:https://...]]` instead? Hi, the syntax is actually as intended. Org interprets whatever is in the `DESCRIPTION` field as what should be displayed to the user, and whatever is in the `LINK` field as the target when clicked on. In this, case, we want to display an image at `https://...`, so that goes into the `DESCRIPTION` field; and say for example if we want the user to be directed to the `LICENSE` file, that's what goes into the `LINK` field. You can refer to an [example repository here](https://github.com/arifer612/spacemacs-literate-layering) that does just this.
Author
Owner

@wxiaoguang commented on GitHub (Feb 2, 2024):

You can refer to an example repository here that does just this.

Let's see this example:

[[LICENSE][https://img.shields.io/badge/license-GPL_3-green.svg]]

It is rendered as:

<a href="/arifer612/spacemacs-literate-layering/blob/master/LICENSE">
    <img src="https://....(the svg)" alt="https://img.shields.io/badge/license-GPL_3-green.svg">
</a>

So I think my understanding is right: [LICENSE] is rendered as a link to /arifer612/spacemacs-literate-layering/blob/master/LICENSE


If you have new cases, could you elaborate them to show the expected output for your cases?

@wxiaoguang commented on GitHub (Feb 2, 2024): > You can refer to an [example repository here](https://github.com/arifer612/spacemacs-literate-layering) that does just this. Let's see this example: `[[LICENSE][https://img.shields.io/badge/license-GPL_3-green.svg]]` It is rendered as: ``` <a href="/arifer612/spacemacs-literate-layering/blob/master/LICENSE"> <img src="https://....(the svg)" alt="https://img.shields.io/badge/license-GPL_3-green.svg"> </a> ``` So I think my understanding is right: `[LICENSE]` is rendered as a link to `/arifer612/spacemacs-literate-layering/blob/master/LICENSE` ---- If you have new cases, could you elaborate them to show the expected output for your cases?
Author
Owner

@arifer612 commented on GitHub (Feb 2, 2024):

I've just commented on the PR, which gives a different example for it:
https://github.com/go-gitea/gitea/pull/29024#discussion_r1475485257

@arifer612 commented on GitHub (Feb 2, 2024): I've just commented on the PR, which gives a different example for it: https://github.com/go-gitea/gitea/pull/29024#discussion_r1475485257
Author
Owner

@arifer612 commented on GitHub (Feb 2, 2024):

Let's see this example:

[[LICENSE][https://img.shields.io/badge/license-GPL_3-green.svg]]

What should be tested, however, is [[LICENSE][file:https://img.shields.io/badge/license-GPL_3-green.svg]].

@arifer612 commented on GitHub (Feb 2, 2024): > Let's see this example: > > `[[LICENSE][https://img.shields.io/badge/license-GPL_3-green.svg]]` > What should be tested, however, is `[[LICENSE][file:https://img.shields.io/badge/license-GPL_3-green.svg]]`.
Author
Owner

@wxiaoguang commented on GitHub (Feb 2, 2024):

I've just commented on the PR, which gives a different example for it:

According to the newly added test case, everything works as expected. https://github.com/go-gitea/gitea/pull/29024#discussion_r1475486691

What should be tested, however, is [[LICENSE][file:https://img.shields.io/badge/license-GPL_3-green.svg]].

Relative links are covered by

image

image

ps: actually, the "relative link handling" is not in this PR's scope. Because, the relative link logic is managed by the common framework (which is for both markdown/orgmode). So if there is any relative link bug, it should be handled from the framework level first.

@wxiaoguang commented on GitHub (Feb 2, 2024): > I've just commented on the PR, which gives a different example for it: According to the newly added test case, everything works as expected. https://github.com/go-gitea/gitea/pull/29024#discussion_r1475486691 > What should be tested, however, is `[[LICENSE][file:https://img.shields.io/badge/license-GPL_3-green.svg]]`. Relative links are covered by <details> ![image](https://github.com/go-gitea/gitea/assets/2114189/e5327444-0181-4618-93f6-0b1d69c75749) ![image](https://github.com/go-gitea/gitea/assets/2114189/30bf7df7-3e3a-4e74-bebb-dc758d970c90) </details> ps: actually, the "relative link handling" is not in this PR's scope. Because, the relative link logic is managed by the common framework (which is for both markdown/orgmode). So if there is any relative link bug, it should be handled from the framework level first.
Author
Owner

@arifer612 commented on GitHub (Feb 2, 2024):

If it's fixed, then all is good, thanks!

Replying to the P.S., the issue here isn't about the relative link handling, I only brought that up because you mentioned that the syntax used was incorrect. Gitea resolves relative links perfectly fine as it is now.

@arifer612 commented on GitHub (Feb 2, 2024): If it's fixed, then all is good, thanks! Replying to the P.S., the issue here isn't about the relative link handling, I only brought that up because you mentioned that the syntax used was incorrect. Gitea resolves relative links perfectly fine as it is now.
Author
Owner

@KN4CK3R commented on GitHub (Feb 2, 2024):

@KN4CK3R sorry I didn't notice that this issue has been assigned to you. If you have been working on this and/or have other approaches, I will close my PR. 🙏

Everything fine, didn't find the time.

@KN4CK3R commented on GitHub (Feb 2, 2024): > @KN4CK3R sorry I didn't notice that this issue has been assigned to you. If you have been working on this and/or have other approaches, I will close my PR. 🙏 Everything fine, didn't find the time.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 28, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 28, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12403