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

Add better error checking for inline html diff code #13239

Merged
merged 5 commits into from
Oct 21, 2020

Conversation

mrsdizzie
Copy link
Member

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

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.
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Oct 21, 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 21, 2020
@codecov-io
Copy link

Codecov Report

Merging #13239 into master will increase coverage by 0.01%.
The diff coverage is 89.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13239      +/-   ##
==========================================
+ Coverage   42.21%   42.22%   +0.01%     
==========================================
  Files         683      683              
  Lines       75458    75450       -8     
==========================================
+ Hits        31851    31860       +9     
+ Misses      38382    38369      -13     
+ Partials     5225     5221       -4     
Impacted Files Coverage Δ
services/gitdiff/gitdiff.go 67.74% <89.28%> (-0.52%) ⬇️
modules/util/timer.go 42.85% <0.00%> (-42.86%) ⬇️
services/pull/pull.go 41.27% <0.00%> (+0.49%) ⬆️
modules/queue/workerpool.go 60.81% <0.00%> (+0.81%) ⬆️
modules/log/file.go 75.20% <0.00%> (+1.60%) ⬆️
services/pull/patch.go 55.68% <0.00%> (+1.70%) ⬆️
services/pull/check.go 51.82% <0.00%> (+2.91%) ⬆️
services/pull/temp_repo.go 29.78% <0.00%> (+3.19%) ⬆️
modules/charset/charset.go 73.03% <0.00%> (+4.49%) ⬆️

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 83106c1...3b0f379. Read the comment docs.

@techknowlogick techknowlogick merged commit f6ee7ce into go-gitea:master Oct 21, 2020
@techknowlogick
Copy link
Member

please send backport :)

@techknowlogick techknowlogick added this to the 1.14.0 milestone Oct 21, 2020
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 <techknowlogick@gitea.io>
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 <art27@cantab.net>

* Update gitdiff_test.go

* fmt

Co-authored-by: zeripath <art27@cantab.net>

* 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 <art27@cantab.net>
@lafriks
Copy link
Member

lafriks commented Oct 23, 2020

Please send backport

@mrsdizzie mrsdizzie added backport/done All backports for this PR have been created and removed backport/v1.13 labels Oct 23, 2020
@mrsdizzie
Copy link
Member Author

@lafriks already done : )

@zeripath
Copy link
Contributor

keep the backport label so we know what it was backported to.

@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. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants