|
8 | 8 | "context"
|
9 | 9 | "fmt"
|
10 | 10 | "os"
|
| 11 | + "path" |
11 | 12 | "path/filepath"
|
12 | 13 | "strings"
|
13 | 14 |
|
@@ -220,21 +221,21 @@ func DeleteUnadoptedRepository(doer, u *user_model.User, repoName string) error
|
220 | 221 | return util.RemoveAll(repoPath)
|
221 | 222 | }
|
222 | 223 |
|
223 |
| -type unadoptedRrepositories struct { |
| 224 | +type unadoptedRepositories struct { |
224 | 225 | repositories []string
|
225 | 226 | index int
|
226 | 227 | start int
|
227 | 228 | end int
|
228 | 229 | }
|
229 | 230 |
|
230 |
| -func (unadopted *unadoptedRrepositories) add(repository string) { |
| 231 | +func (unadopted *unadoptedRepositories) add(repository string) { |
231 | 232 | if unadopted.index >= unadopted.start && unadopted.index < unadopted.end {
|
232 | 233 | unadopted.repositories = append(unadopted.repositories, repository)
|
233 | 234 | }
|
234 | 235 | unadopted.index++
|
235 | 236 | }
|
236 | 237 |
|
237 |
| -func checkUnadoptedRepositories(userName string, repoNamesToCheck []string, unadopted *unadoptedRrepositories) error { |
| 238 | +func checkUnadoptedRepositories(userName string, repoNamesToCheck []string, unadopted *unadoptedRepositories) error { |
238 | 239 | if len(repoNamesToCheck) == 0 {
|
239 | 240 | return nil
|
240 | 241 | }
|
@@ -266,7 +267,7 @@ func checkUnadoptedRepositories(userName string, repoNamesToCheck []string, unad
|
266 | 267 | }
|
267 | 268 | for _, repoName := range repoNamesToCheck {
|
268 | 269 | if _, ok := repoNames[repoName]; !ok {
|
269 |
| - unadopted.add(filepath.Join(userName, repoName)) |
| 270 | + unadopted.add(path.Join(userName, repoName)) // These are not used as filepaths - but as reponames - therefore use path.Join not filepath.Join |
270 | 271 | }
|
271 | 272 | }
|
272 | 273 | return nil
|
@@ -294,7 +295,7 @@ func ListUnadoptedRepositories(query string, opts *db.ListOptions) ([]string, in
|
294 | 295 | var repoNamesToCheck []string
|
295 | 296 |
|
296 | 297 | start := (opts.Page - 1) * opts.PageSize
|
297 |
| - unadopted := &unadoptedRrepositories{ |
| 298 | + unadopted := &unadoptedRepositories{ |
298 | 299 | repositories: make([]string, 0, opts.PageSize),
|
299 | 300 | start: start,
|
300 | 301 | end: start + opts.PageSize,
|
|
0 commit comments