diff options
| author | James Mills <prologic@shortcircuit.net.au> | 2020-03-22 18:18:59 +1000 |
|---|---|---|
| committer | James Mills <prologic@shortcircuit.net.au> | 2020-03-22 18:18:59 +1000 |
| commit | dd710e69b69f82448eafba22dc5e4bb7f7b57f6c (patch) | |
| tree | 92a6833f49f56eb9391e41628a22b6841a631688 /app/app.go | |
| parent | a90739089110e9f92653792bb1f23888ad734a79 (diff) | |
Fixed nil refernece bug
Diffstat (limited to 'app/app.go')
| -rw-r--r-- | app/app.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -11,6 +11,7 @@ import ( "os" "path" "path/filepath" + "sort" "strings" rice "github.com/GeertJohan/go.rice" @@ -166,7 +167,14 @@ func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) { defer file.Close() // TODO: Make collection user selectable from drop-down in Form - collection := "videos" + // XXX: Assume we can put uploaded videos into the first collection (sorted) we find + keys := make([]string, 0, len(a.Library.Paths)) + for k := range a.Library.Paths { + keys = append(keys, k) + } + sort.Strings(keys) + collection := keys[0] + fn := filepath.Join( a.Config.Server.UploadPath, fmt.Sprintf( |
