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

Fix missing images in editor preview due to wrong links #31299

Merged
merged 10 commits into from
Jun 17, 2024

Conversation

brechtvl
Copy link
Contributor

@brechtvl brechtvl commented Jun 9, 2024

Parse base path and tree path so that media links can be correctly created with /media/.

Resolves #31294

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 9, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 9, 2024
@brechtvl
Copy link
Contributor Author

brechtvl commented Jun 9, 2024

This parsing of the URL seems like a hack, though it's not clear to me what else could be done without breaking the API.

@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Jun 9, 2024
@techknowlogick techknowlogick added the backport/v1.22 This PR should be backported to Gitea 1.22 label Jun 10, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 10, 2024
routers/common/markup.go Outdated Show resolved Hide resolved
routers/common/markup.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 11, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 11, 2024
@wxiaoguang wxiaoguang removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 11, 2024
@wxiaoguang
Copy link
Contributor

@KN4CK3R would you also like to take a look?

@wxiaoguang wxiaoguang force-pushed the fix-editor-images branch 2 times, most recently from 3c2c87a to 75d5e92 Compare June 16, 2024 10:43
@wxiaoguang
Copy link
Contributor

Did some rewriting, I think the problems are clear now 75d5e92

brechtvl and others added 4 commits June 16, 2024 18:55
Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves go-gitea#31294
Swagger did not render <> so use {}.
@wxiaoguang
Copy link
Contributor

Rebased with main because it needs a new method GuessCurrentHostURL

Copy link
Contributor Author

@brechtvl brechtvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the implementation.

routers/common/markup.go Outdated Show resolved Hide resolved
@wxiaoguang
Copy link
Contributor

If nothing more to change, I am going to merge this PR in one day. 🙏

@KN4CK3R
Copy link
Member

KN4CK3R commented Jun 16, 2024

The /markup and /markdown endpoints were problematic when I wrote #26745 because there is not much context to create a logic for every case. But as this now satisfies the old tests everything is fine.

@wxiaoguang wxiaoguang merged commit 597d1da into go-gitea:main Jun 17, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Jun 17, 2024
@GiteaBot
Copy link
Contributor

I was unable to create a backport for 1.22. @brechtvl, please send one manually. 🍵

go run ./contrib/backport 31299
...  // fix git conflicts if any
go run ./contrib/backport --continue

@GiteaBot GiteaBot added the backport/manual No power to the bots! Create your backport yourself! label Jun 17, 2024
@wxiaoguang
Copy link
Contributor

I will try to backport it manually.

wxiaoguang pushed a commit to wxiaoguang/gitea that referenced this pull request Jun 17, 2024
Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves go-gitea#31294

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
# Conflicts:
#	routers/common/markup.go
@wxiaoguang wxiaoguang added the backport/done All backports for this PR have been created label Jun 17, 2024
wxiaoguang pushed a commit to wxiaoguang/gitea that referenced this pull request Jun 17, 2024
Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves go-gitea#31294

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
# Conflicts:
#	routers/common/markup.go
wxiaoguang added a commit that referenced this pull request Jun 17, 2024
)

Backport #31299

Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves #31294

---------

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 18, 2024
* giteaofficial/main:
  Fix rendered wiki page link (go-gitea#31398)
  Refactor repo unit "disabled" check (go-gitea#31389)
  Refactor route path normalization (go-gitea#31381)
  Refactor markup code (go-gitea#31399)
  Add cache test for admins (go-gitea#31265)
  Fix double border in system status table (go-gitea#31363)
  Improve rubygems package registry (go-gitea#31357)
  Fix natural sort (go-gitea#31384)
  Fix missing images in editor preview due to wrong links (go-gitea#31299)
  Add a simple test for AdoptRepository (go-gitea#31391)
  [skip ci] Updated licenses and gitignores
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/manual No power to the bots! Create your backport yourself! backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Images missing in editor markdown preview
9 participants