Skip to content

Allow to merge if file path contains " or \ (#8629)#8772

Merged
techknowlogick merged 1 commit into
go-gitea:release/v1.9from
zeripath:backport-8629-1.9
Nov 1, 2019
Merged

Allow to merge if file path contains " or \ (#8629)#8772
techknowlogick merged 1 commit into
go-gitea:release/v1.9from
zeripath:backport-8629-1.9

Conversation

@zeripath

@zeripath zeripath commented Nov 1, 2019

Copy link
Copy Markdown
Contributor

Backport #8629 on to release/v1.9

  • if a filename in a repository contains " or \ the owner can't merge pull request with this files
    because "git diff-tree" adds double quotes to that filepath
    example: filepath is ab"cd but "git diff-tree" returns "ab"cd"

now, when the owner click "Merge Pull Request" button the server returns 500
this commit fix it

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • add -z option to getDiffTree
    escape spec symbols for sparse-checkout

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • go fmt

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • typo

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • escape ''
    escape all spaces and '!'

  • use regexp.ReplaceAllString()

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • strings.ReplaceAll was added in go 1.12

Signed-off-by: Ilya Pavlov ilux@cpan.org

  • add '' to regexp.MustCompile

Signed-off-by: Ilya Pavlov ilux@cpan.org

Please check the following:

  1. Make sure you are targeting the master branch, pull requests on release branches are only allowed for bug fixes.
  2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/master/CONTRIBUTING.md
  3. Describe what your pull request does and which issue you're targeting (if any)

You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.

* if a filename in a repository contains " or \ the owner can't merge pull request with this files
because "git diff-tree" adds double quotes to that filepath
example: filepath is ab"cd but "git diff-tree" returns "ab\"cd"

now, when the owner click "Merge Pull Request" button the server returns 500
this commit fix it

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* add -z option to getDiffTree
escape spec symbols for sparse-checkout

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* go fmt

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* typo

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* escape '\'
escape all spaces and '!'

* use regexp.ReplaceAllString()

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* strings.ReplaceAll was added in go 1.12

Signed-off-by: Ilya Pavlov <ilux@cpan.org>

* add '\' to regexp.MustCompile

Signed-off-by: Ilya Pavlov <ilux@cpan.org>
@lafriks

lafriks commented Nov 1, 2019

Copy link
Copy Markdown
Member

I don't think we will release more 1.9 releases if only for critical security issues

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 1, 2019
@zeripath

zeripath commented Nov 1, 2019

Copy link
Copy Markdown
Contributor Author

I thought I'd put it out there as a possible pr given we haven't released 1.10 yet.

@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 Nov 1, 2019
@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 Nov 1, 2019
@techknowlogick techknowlogick added this to the 1.9.6 milestone Nov 1, 2019
@techknowlogick techknowlogick merged commit f104898 into go-gitea:release/v1.9 Nov 1, 2019
@zeripath zeripath deleted the backport-8629-1.9 branch November 1, 2019 21:29
@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