Skip to content

Commit 76e742a

Browse files
committed
Fix the possible path problem
1 parent da76fc1 commit 76e742a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

models/repo/repo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ func RelativePath(ownerName, repoName string) string {
219219
return strings.ToLower(ownerName) + "/" + strings.ToLower(repoName) + ".git"
220220
}
221221

222+
// RelativePath should be an unix style path like username/reponame.git
222223
func (repo *Repository) RelativePath() string {
223224
return RelativePath(repo.OwnerName, repo.Name)
224225
}
225226

226227
type StorageRepo string
227228

229+
// RelativePath should be an unix style path like username/reponame.git
228230
func (sr StorageRepo) RelativePath() string {
229231
return string(sr)
230232
}

modules/gitrepo/gitrepo.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ type Repository interface {
2020
RelativePath() string // We don't assume how the directory structure of the repository is, so we only need the relative path
2121
}
2222

23+
// RelativePath should be an unix style path like username/reponame.git
24+
// This method should change it according to the current OS.
2325
func repoPath(repo Repository) string {
24-
return filepath.Join(setting.RepoRootPath, repo.RelativePath())
26+
return filepath.Join(setting.RepoRootPath, filepath.FromSlash(repo.RelativePath()))
2527
}
2628

2729
// OpenRepository opens the repository at the given relative path with the provided context.

0 commit comments

Comments
 (0)