Skip to content

Conversation

@sapk
Copy link
Member

@sapk sapk commented May 31, 2018

And add more tests

@techknowlogick
Copy link
Member

Comment to link issue to PR #4090

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 31, 2018
@techknowlogick
Copy link
Member

CI fail. I restarted Drone, but same fail happened. Looks like it is related to this change.

@lafriks
Copy link
Member

lafriks commented Jun 1, 2018

Seems to me it breaks links like path/name.jpg as it escapes also / characters

@sapk
Copy link
Member Author

sapk commented Jun 1, 2018

@lafriks You are totally right!
I first think of removing it for image link but choose to only url-encode when we have only a filename like [[Test?#]]. The user could still use the format [[some/path/Test?#|some/path/Test%3F%23]] for advanced use cases.

@codecov-io
Copy link

codecov-io commented Jun 1, 2018

Codecov Report

Merging #4091 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4091      +/-   ##
==========================================
- Coverage   19.96%   19.96%   -0.01%     
==========================================
  Files         153      153              
  Lines       30521    30524       +3     
==========================================
  Hits         6094     6094              
- Misses      23513    23515       +2     
- Partials      914      915       +1
Impacted Files Coverage Δ
modules/markup/html.go 79.9% <100%> (+0.14%) ⬆️
modules/process/manager.go 69.56% <0%> (-4.35%) ⬇️

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 c919b07...425e702. Read the comment docs.

@lafriks
Copy link
Member

lafriks commented Jun 2, 2018

Or probably you can escape only last part by splitting /

@sapk
Copy link
Member Author

sapk commented Jun 2, 2018

@lafriks I think of it but I didn't go that way as I find it kind of strange to encode only part of the url and a other solution could be to encode all except /.
I did some testing on github to know how they do it and I find that they encode all url and translate / in - and that they don't do support [[ ]] in issue comment but doing so may break how we do it and previous link.

So I choose a simple implementation only supporting filename without path but I can change if needed.

@sapk sapk changed the title Fix #4090 by escaping page/img link for short link Fix #4090 by escaping filename page/img link (without path) for short link Jun 2, 2018
@lafriks
Copy link
Member

lafriks commented Jun 2, 2018

I would prefer to have behaviour same as GitHub so that imported/mirrored GitHub wiki/md would work same also on Gitea but that probably can be done in other PR

@bkcsoft bkcsoft 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 2, 2018
@bkcsoft bkcsoft 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 15, 2018
@lunny lunny merged commit 23ba5c8 into go-gitea:master Jun 15, 2018
@lunny
Copy link
Member

lunny commented Jun 15, 2018

@sapk please send a back port to v1.4

@lunny lunny mentioned this pull request Jun 15, 2018
7 tasks
@sapk sapk deleted the fix-4090 branch June 15, 2018 16:29
@sapk sapk restored the fix-4090 branch June 15, 2018 16:29
@sapk sapk deleted the fix-4090 branch June 15, 2018 17:13
sapk added a commit to sapk-fork/gitea that referenced this pull request Jun 15, 2018
lunny pushed a commit that referenced this pull request Jun 17, 2018
@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.

7 participants