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: media links in org files not liked to media files #12997

Merged
merged 3 commits into from
Oct 1, 2020

Conversation

0Pranav
Copy link

@0Pranav 0Pranav commented Oct 1, 2020

In Org files, links to images and videos will be linked to "/media/" path, similar to

link := v.Destination
if len(link) > 0 && !markup.IsLink(link) {
prefix := pc.Get(urlPrefixKey).(string)
if pc.Get(isWikiKey).(bool) {
prefix = giteautil.URLJoin(prefix, "wiki", "raw")
}
prefix = strings.Replace(prefix, "/src/", "/media/", 1)

Fixes #12831

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2020

Codecov Report

Merging #12997 into master will increase coverage by 0.00%.
The diff coverage is 60.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #12997   +/-   ##
=======================================
  Coverage   42.58%   42.59%           
=======================================
  Files         671      671           
  Lines       73625    73632    +7     
=======================================
+ Hits        31356    31365    +9     
+ Misses      37193    37184    -9     
- Partials     5076     5083    +7     
Impacted Files Coverage Δ
modules/markup/orgmode/orgmode.go 75.51% <60.00%> (-3.07%) ⬇️
modules/notification/ui/ui.go 80.55% <0.00%> (-2.78%) ⬇️
services/pull/check.go 47.69% <0.00%> (-2.31%) ⬇️
models/notification.go 65.76% <0.00%> (-0.91%) ⬇️
models/error.go 34.85% <0.00%> (-0.34%) ⬇️
modules/notification/mail/mail.go 34.48% <0.00%> (ø)
modules/git/repo.go 46.70% <0.00%> (+0.50%) ⬆️
services/mailer/mail.go 55.91% <0.00%> (+1.07%) ⬆️
models/unit.go 49.31% <0.00%> (+2.73%) ⬆️
modules/git/utils.go 77.04% <0.00%> (+3.27%) ⬆️
... and 3 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 1d2553a...c751583. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 1, 2020
modules/markup/orgmode/orgmode.go Outdated Show resolved Hide resolved
modules/markup/orgmode/orgmode.go Outdated Show resolved Hide resolved
modules/markup/orgmode/orgmode.go Outdated Show resolved Hide resolved
@zeripath
Copy link
Contributor

zeripath commented Oct 1, 2020

Thanks for the PR - this looks like it would solve the problem - however, as a r is an io.Writer we should just get fmt.Fprintf to write to it directly instead of using the r.WriteString method.

as suggested by code review

Co-authored-by: zeripath <art27@cantab.net>
@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 Oct 1, 2020
@zeripath zeripath added this to the 1.13.0 milestone Oct 1, 2020
@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 Oct 1, 2020
@techknowlogick techknowlogick merged commit 1827f89 into go-gitea:master Oct 1, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
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. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relative path in Org files does not link to raw files
6 participants