Fixed nil refernece bug

This commit is contained in:
James Mills 2020-03-22 18:18:59 +10:00
parent a907390891
commit dd710e69b6
No known key found for this signature in database
GPG key ID: AC4C014F1440EBD6
2 changed files with 58 additions and 50 deletions

View file

@ -11,6 +11,7 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"sort"
"strings" "strings"
rice "github.com/GeertJohan/go.rice" rice "github.com/GeertJohan/go.rice"
@ -166,7 +167,14 @@ func (a *App) uploadHandler(w http.ResponseWriter, r *http.Request) {
defer file.Close() defer file.Close()
// TODO: Make collection user selectable from drop-down in Form // 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( fn := filepath.Join(
a.Config.Server.UploadPath, a.Config.Server.UploadPath,
fmt.Sprintf( fmt.Sprintf(

File diff suppressed because one or more lines are too long