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

Links in markdown should be absolute to the repository not the server #15088

Merged

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Mar 21, 2021

Currently Gitea will render links like:

![/capybara.jpg/capybara-train.jpg](/capybara.jpg/capybara-train.jpg)
![capybara][capybara-train-jpg]

  [capybara-train-jpg]: /capybara.jpg/capybara-train.jpg

as being absolute with respect to the server when they should be relative to the repository prefix in order to be github compatible.

Fix #15075

⚠️ BREAKING ⚠️

This represents a change in the rendering of these links - however, it makes them match Github so the previous behaviour was a bug.

Signed-off-by: Andrew Thornton art27@cantab.net

Fix go-gitea#15075

Signed-off-by: Andrew Thornton <art27@cantab.net>
@6543
Copy link
Member

6543 commented Mar 21, 2021

Can you add some unit tests?

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 21, 2021
@lafriks

This comment has been minimized.

@6543
Copy link
Member

6543 commented Mar 21, 2021

@zeripath

This comment has been minimized.

@zeripath
Copy link
Contributor Author

Ugh actually the situation is more complex indeed.

Take a look at https://github.com/zeripath/pathological/blob/master/README.md

@lunny

This comment has been minimized.

@zeripath
Copy link
Contributor Author

Fixed this! It should now replicate the GH way.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@lunny
Copy link
Member

lunny commented Mar 26, 2021

So the absolute path to site will break. I think we should mark this as break.

@zeripath
Copy link
Contributor Author

Well... The current behaviour is a bug when compared to GitHub compatibility.

Do we know what gitlab does? If we can show that gitlab doesn't behave the same then we can probably make it a flag etc.

@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 Apr 10, 2021
@6543 6543 added pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! and removed backport/v1.13 labels Apr 10, 2021
@6543
Copy link
Member

6543 commented Apr 10, 2021

@6543 6543 added type/enhancement An improvement of existing functionality and removed type/bug labels Apr 10, 2021
@codecov-io
Copy link

Codecov Report

Merging #15088 (6ebcf69) into master (84f5a0b) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #15088   +/-   ##
=======================================
  Coverage   43.93%   43.93%           
=======================================
  Files         677      677           
  Lines       81332    81332           
=======================================
  Hits        35732    35732           
+ Misses      39804    39799    -5     
- Partials     5796     5801    +5     
Impacted Files Coverage Δ
modules/markup/markdown/goldmark.go 58.22% <100.00%> (ø)
modules/git/repo_base_nogogit.go 63.63% <0.00%> (-9.10%) ⬇️
modules/indexer/stats/db.go 48.00% <0.00%> (-8.00%) ⬇️
modules/git/utils.go 77.77% <0.00%> (-2.78%) ⬇️
modules/log/file.go 73.80% <0.00%> (-1.59%) ⬇️
modules/queue/unique_queue_disk_channel.go 53.73% <0.00%> (-1.50%) ⬇️
models/issue_comment.go 52.16% <0.00%> (-0.58%) ⬇️
services/pull/pull.go 43.30% <0.00%> (-0.49%) ⬇️
models/error.go 38.58% <0.00%> (-0.48%) ⬇️
modules/git/blame.go 67.14% <0.00%> (+1.42%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84f5a0b...6ebcf69. Read the comment docs.

@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 Apr 10, 2021
@lunny lunny merged commit c680eb2 into go-gitea:master Apr 10, 2021
@zeripath zeripath deleted the fix-15075-fix-reference-link-relative-paths branch April 10, 2021 18:25
@silverwind
Copy link
Member

Any reason not to backport this to 1.14?

@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mirror project: wrong path to images
7 participants