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 error in diff html rendering #13191

Merged
merged 5 commits into from
Oct 18, 2020

Conversation

mrsdizzie
Copy link
Member

Was missing an optional whitespace check in regex. Also noticed a rare case where diff.Type == Equal text would be empty and thus get a newline attached. Fixed that too.

Fixes #13177

Was missing an optional whitespace check in regex. Also noticed a rare case where diff.Type == Equal would be empty and thus get a newline attached. Fixed that too.

Fixes go-gitea#13177
@mrsdizzie mrsdizzie added backport/v1.13 type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Oct 17, 2020
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 17, 2020
@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 18, 2020
@zeripath zeripath added this to the 1.14.0 milestone Oct 18, 2020
@silverwind
Copy link
Member

Maybe worth adding a test for?

@codecov-io
Copy link

codecov-io commented Oct 18, 2020

Codecov Report

Merging #13191 into master will decrease coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13191      +/-   ##
==========================================
- Coverage   42.01%   42.01%   -0.01%     
==========================================
  Files         683      683              
  Lines       75215    75215              
==========================================
- Hits        31605    31601       -4     
- Misses      38443    38450       +7     
+ Partials     5167     5164       -3     
Impacted Files Coverage Δ
routers/repo/http.go 43.11% <0.00%> (ø)
services/gitdiff/gitdiff.go 68.25% <100.00%> (ø)
services/pull/temp_repo.go 26.59% <0.00%> (-3.20%) ⬇️
services/pull/check.go 48.90% <0.00%> (-2.92%) ⬇️
services/pull/patch.go 52.84% <0.00%> (-1.71%) ⬇️
modules/queue/workerpool.go 58.77% <0.00%> (-1.23%) ⬇️
services/pull/pull.go 41.27% <0.00%> (+0.49%) ⬆️
modules/git/repo.go 46.70% <0.00%> (+0.50%) ⬆️
modules/queue/unique_queue_disk_channel.go 55.38% <0.00%> (+1.53%) ⬆️
modules/git/utils.go 77.04% <0.00%> (+3.27%) ⬆️
... and 1 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 5e34d3d...e6f5d12. 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 Oct 18, 2020
@techknowlogick techknowlogick merged commit 9fe4b7b into go-gitea:master Oct 18, 2020
mrsdizzie added a commit to mrsdizzie/gitea that referenced this pull request Oct 21, 2020
A better fix for go-gitea#13191 which cleans up this code a bit and adds basic checking which should avoid writing broken HTML in future situations.
ivanvc added a commit to ivanvc/gitea that referenced this pull request Oct 21, 2020
…ments-in-pull-request-label-style

* origin/master: (27 commits)
  [skip ci] Updated translations via Crowdin
  add more clarification to the issue-template.md (go-gitea#13235)
  go-version constraints ignore pre-releases (go-gitea#13234)
  [skip ci] Updated translations via Crowdin
  Update some JS dependencies (go-gitea#13222)
  Return the full rejection message and errors in flash errors (go-gitea#13221)
  Update heatmap fixtures to restore tests (go-gitea#13224)
  [skip ci] Updated translations via Crowdin
  Add review request api (go-gitea#11355)
  [skip ci] Updated translations via Crowdin
  When the git ref is unable to be found return broken pr (go-gitea#13218)
  Various arc-green fixes (go-gitea#13214)
  Show stale label for stale code comment which is marked as resolved (go-gitea#13213)
  Move install pages out of main macaron routes (go-gitea#13195)
  Use CSS Variables for fonts, remove postcss-loader (go-gitea#13204)
  [skip ci] Updated translations via Crowdin
  Align `SSH_AUTHORIZED_KEYS_BACKUP` var with the value in `app.ini` (go-gitea#13212)
  Fix size and clickable area on file table back link (go-gitea#13205)
  [skip ci] Updated translations via Crowdin
  Fix error in diff html rendering (go-gitea#13191)
  ...
techknowlogick added a commit that referenced this pull request Oct 21, 2020
* Add better error checking for inline html diff code

A better fix for #13191 which cleans up this code a bit and adds basic checking which should avoid writing broken HTML in future situations.

* Update gitdiff_test.go

* better regex

Co-authored-by: techknowlogick <[email protected]>
mrsdizzie added a commit to mrsdizzie/gitea that referenced this pull request Oct 21, 2020
* Fix error in diff html rendering

Was missing an optional whitespace check in regex. Also noticed a rare case where diff.Type == Equal would be empty and thus get a newline attached. Fixed that too.

Fixes go-gitea#13177

* Update services/gitdiff/gitdiff.go

Co-authored-by: zeripath <[email protected]>

* Update gitdiff_test.go

* fmt

Co-authored-by: zeripath <[email protected]>
mrsdizzie added a commit to mrsdizzie/gitea that referenced this pull request Oct 21, 2020
* Add better error checking for inline html diff code

A better fix for go-gitea#13191 which cleans up this code a bit and adds basic checking which should avoid writing broken HTML in future situations.

* Update gitdiff_test.go

* better regex

Co-authored-by: techknowlogick <[email protected]>
techknowlogick pushed a commit that referenced this pull request Oct 22, 2020
* Fix error in diff html rendering (#13191)

* Fix error in diff html rendering

Was missing an optional whitespace check in regex. Also noticed a rare case where diff.Type == Equal would be empty and thus get a newline attached. Fixed that too.

Fixes #13177

* Update services/gitdiff/gitdiff.go

Co-authored-by: zeripath <[email protected]>

* Update gitdiff_test.go

* fmt

Co-authored-by: zeripath <[email protected]>

* Add better error checking for inline html diff code (#13239)

* Add better error checking for inline html diff code

A better fix for #13191 which cleans up this code a bit and adds basic checking which should avoid writing broken HTML in future situations.

* Update gitdiff_test.go

* better regex

Co-authored-by: zeripath <[email protected]>
@zeripath
Copy link
Contributor

I guess the backport for this was included in #13239

@zeripath zeripath added the backport/done All backports for this PR have been created label Oct 25, 2020
@mrsdizzie
Copy link
Member Author

@zeripath indeed it was

@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
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

diff view leaks some html code
6 participants