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

Error when pasting an attachment #28915

Closed
CrowMash opened this issue Jan 24, 2024 · 5 comments · Fixed by #28932
Closed

Error when pasting an attachment #28915

CrowMash opened this issue Jan 24, 2024 · 5 comments · Fixed by #28932
Labels
Milestone

Comments

@CrowMash
Copy link

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

@FrostKiwi
Copy link

FrostKiwi commented 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.

@lunny
Copy link
Member

lunny commented Jan 25, 2024

Maybe related with #26745 @KN4CK3R

@KN4CK3R
Copy link
Member

KN4CK3R commented Jan 25, 2024

Don't really know if it's related. The comment content code is here:

comment.RenderedContent, err = markdown.RenderString(&markup.RenderContext{
Links: markup.Links{
Base: ctx.Repo.RepoLink,
},
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
GitRepo: ctx.Repo.GitRepo,
Ctx: ctx,
}, comment.Content)

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
Copy link
Member

KN4CK3R commented 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...

@lunny lunny added this to the 1.21.5 milestone Jan 26, 2024
lunny pushed a commit that referenced this issue Jan 27, 2024
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants