aboutsummaryrefslogtreecommitdiff
path: root/internal/db/repo_editor.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-06-04 13:11:29 +0800
committerGitHub <noreply@github.com>2022-06-04 13:11:29 +0800
commit38aff73251cc46ced96dd608dab6190415032a82 (patch)
tree4f003d7ddfa8dc418d9187bbfd52a167f113ab7a /internal/db/repo_editor.go
parent69827490e0f0e68b34e082321b4e328df7847d66 (diff)
repo_editor: check both styles of `os.PathSeparator` in all systems (#7005)
Diffstat (limited to 'internal/db/repo_editor.go')
-rw-r--r--internal/db/repo_editor.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/db/repo_editor.go b/internal/db/repo_editor.go
index 9d4664be..98065d43 100644
--- a/internal/db/repo_editor.go
+++ b/internal/db/repo_editor.go
@@ -467,10 +467,12 @@ type UploadRepoFileOptions struct {
// path of the repository.
func isRepositoryGitPath(path string) bool {
return strings.HasSuffix(path, ".git") ||
- strings.Contains(path, ".git"+string(os.PathSeparator)) ||
+ strings.Contains(path, ".git/") ||
+ strings.Contains(path, `.git\`) ||
// Windows treats ".git." the same as ".git"
strings.HasSuffix(path, ".git.") ||
- strings.Contains(path, ".git."+string(os.PathSeparator))
+ strings.Contains(path, ".git./") ||
+ strings.Contains(path, `.git.\`)
}
func (repo *Repository) UploadRepoFiles(doer *User, opts UploadRepoFileOptions) error {