Error when pasting an attachment #12378

Closed
opened 2025-11-02 10:07:58 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @CrowMash on GitHub (Jan 24, 2024).

Description

In issues, when I paste a screenshot, the attachment does not appear:

image

But in the project view, I can see the image:

image

Looks like the URL in the image src does not contain the base URL (/gitea/ in my case):

image

Gitea Version

1.21.4 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.30.2, Wire Protocol Version 2 Enabled

Operating System

debian 11

How are you running Gitea?

Installation from binary

Database

MySQL/MariaDB

Originally created by @CrowMash on GitHub (Jan 24, 2024). ### Description In issues, when I paste a screenshot, the attachment does not appear: ![image](https://github.com/go-gitea/gitea/assets/9526631/5090c566-4481-4a6b-bf59-2f1de4f76a54) But in the project view, I can see the image: ![image](https://github.com/go-gitea/gitea/assets/9526631/50e0e71a-00c5-4e45-9503-917c57664c9b) Looks like the URL in the image src does not contain the base URL (/gitea/ in my case): ![image](https://github.com/go-gitea/gitea/assets/9526631/79ad2846-fe5a-405e-a004-d23e3cdf650b) ### Gitea Version 1.21.4 built with GNU Make 4.3, go1.21.5 : bindata, sqlite, sqlite_unlock_notify ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.30.2, Wire Protocol Version 2 Enabled ### Operating System debian 11 ### How are you running Gitea? Installation from binary ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:07:58 -06:00
Author
Owner

@FrostKiwi commented on GitHub (Jan 25, 2024):

I would like to confirm this on our setup as well. Hit us when upgrading from 1.21.1 to 1.21.4.

Issues' and PR's image links suddenly ignore the root URL, which is a subpath in our case. Our ROOT_URL is https://subdomain.example.com/git/
Images are still there and valid accessible in the attached files section, where they take on the form of https://subdomain.example.com/git/attachments/<hash>. As mentioned by @CrowMash, the project cards respect this Root path. However, in PRs and Issues they turn into https://subdomain.example.com/attachments/<hash>

A backup is present, but still, is it safe to downgrade to solve this temporarily?

edit: Since as per documentation, a change in the last digit 1.21.x does not constitute an update modifying something about the database, I downgraded to 1.21.1. Images work again.

@FrostKiwi commented on GitHub (Jan 25, 2024): I would like to confirm this on our setup as well. Hit us when upgrading from `1.21.1` to `1.21.4`. Issues' and PR's image links suddenly ignore the root URL, which is a subpath in our case. Our `ROOT_URL` is `https://subdomain.example.com/git/` Images are still there and valid accessible in the attached files section, where they take on the form of `https://subdomain.example.com/git/attachments/<hash>`. As mentioned by @CrowMash, the project cards respect this Root path. However, in PRs and Issues they turn into `https://subdomain.example.com/attachments/<hash>` A backup is present, but still, is it safe to downgrade to solve this temporarily? edit: Since as per documentation, a change in the last digit `1.21.x` does not constitute an update modifying something about the database, I downgraded to `1.21.1`. Images work again.
Author
Owner

@lunny commented on GitHub (Jan 25, 2024):

Maybe related with #26745 @KN4CK3R

@lunny commented on GitHub (Jan 25, 2024): Maybe related with #26745 @KN4CK3R
Author
Owner

@KN4CK3R commented on GitHub (Jan 25, 2024):

Don't really know if it's related. The comment content code is here:
3084c990b0/routers/web/repo/issue.go (L1620-L1627)

And the change I did is here:
https://github.com/go-gitea/gitea/pull/26745/files#diff-dc86301f15109eee38296d469630672193e0587ad1485fdd8f503bf4c789cf7eL1603

So, nothing really changed to the path, both use ctx.Repo.RepoLink. Maybe something is wrong with that but in that case much more should be broken.

@KN4CK3R commented on GitHub (Jan 25, 2024): Don't really know if it's related. The comment content code is here: https://github.com/go-gitea/gitea/blob/3084c990b04aea16278f012da38152ada1290a0d/routers/web/repo/issue.go#L1620-L1627 And the change I did is here: https://github.com/go-gitea/gitea/pull/26745/files#diff-dc86301f15109eee38296d469630672193e0587ad1485fdd8f503bf4c789cf7eL1603 So, nothing really changed to the path, both use `ctx.Repo.RepoLink`. Maybe something is wrong with that but in that case much more should be broken.
Author
Owner

@KN4CK3R commented on GitHub (Jan 25, 2024):

Found it... This line converts /attachments to attachments which does not resolve to the root of the url. Looks more like a workaround...

@KN4CK3R commented on GitHub (Jan 25, 2024): Found it... [This](https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96) line converts `/attachments` to `attachments` which does not resolve to the root of the url. Looks more like a workaround...
Author
Owner

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

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 29, 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#12378