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