-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 diff path unquoting #12554
Fix diff path unquoting #12554
Conversation
services/gitdiff/gitdiff.go whereby there it assumed that the path would always be quoted on both sides This PR simplifies the code here and uses fmt.Fscanf to parse the strings as necessary. Fix go-gitea#12546 Signed-off-by: Andrew Thornton <art27@cantab.net>
Codecov Report
@@ Coverage Diff @@
## master #12554 +/- ##
==========================================
- Coverage 43.44% 43.44% -0.01%
==========================================
Files 643 643
Lines 71159 71155 -4
==========================================
- Hits 30914 30912 -2
Misses 35236 35236
+ Partials 5009 5007 -2
Continue to review full report at Codecov.
|
Maybe add a test here for the case that caused linked issue: gitea/services/gitdiff/gitdiff_test.go Line 80 in a048489
|
Signed-off-by: Andrew Thornton <art27@cantab.net>
…ting-of-git-diff-paths
Backport go-gitea#12554 * Fix diff path unquoting services/gitdiff/gitdiff.go whereby there it assumed that the path would always be quoted on both sides This PR simplifies the code here and uses fmt.Fscanf to parse the strings as necessary. Fix go-gitea#12546 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add testcase as per @mrsdizzie Signed-off-by: Andrew Thornton <art27@cantab.net>
Backport #12554 * Fix diff path unquoting services/gitdiff/gitdiff.go whereby there it assumed that the path would always be quoted on both sides This PR simplifies the code here and uses fmt.Fscanf to parse the strings as necessary. Fix #12546 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add testcase as per @mrsdizzie Signed-off-by: Andrew Thornton <art27@cantab.net>
Hey @zeripath ! this fix breaks filenames with blanks in path (filename or foldername). If you have you get now this wrong variable assignments:
And the this two lines at https://github.com/go-gitea/gitea/blob/master/services/gitdiff/gitdiff.go#L592
are deleting the first two characters resulting in
In the diff you see a renaming The bug is getting worse if the filename has only a single character after the first blank, e.g. Resulting in
Because strlen of b is only 2 the substring(b, 2)/ (
So the Now filenames with blanks are completely broken in 1.12.4 and master! Why ignoring the lines with Kind Regards |
@fashberg Could you send a new issue? |
@lunny: yep, sure. |
services/gitdiff/gitdiff.go whereby there it assumed that the path would
always be quoted on both sides
This PR simplifies the code here and uses fmt.Fscanf to parse the
strings as necessary.
Fix #12546
Signed-off-by: Andrew Thornton art27@cantab.net