()
| 20 | } |
| 21 | |
| 22 | func (r *uploadResolver) refresh() error { |
| 23 | r.mu.Lock() |
| 24 | defer r.mu.Unlock() |
| 25 | files, err := os.ReadDir(uploadsPath) |
| 26 | if err != nil { |
| 27 | return errors.WithMessage(err, "read uploads dir") |
| 28 | } |
| 29 | files = util.RemoveHiddenDirs(files) |
| 30 | for _, file := range files { |
| 31 | if filepath.Ext(file.Name()) == ".info" { |
| 32 | continue |
| 33 | } |
| 34 | id := file.Name() |
| 35 | r.idToUploadMap[id] = loadUpload(id) |
| 36 | } |
| 37 | return nil |
| 38 | } |
| 39 | |
| 40 | func loadUpload(id string) Upload { |
| 41 | return newUpload(id) |
nothing calls this directly
no test coverage detected