diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-13 00:36:41 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-13 00:36:41 (GMT) |
commit | cccba3ce2e7a5797c84c78bce7e8d24fdcb8fce7 (patch) | |
tree | bd47642c036facf30b693a4c6a93131a14301f1d /src/helsinki.at/rhimportd | |
parent | 60a2313659b57f66d502d44729b6b78f07bd3883 (diff) |
GroupName should now be only supplied for music pools
added context SanityCheck before fetching files
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlWebSimple.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go index a57e8c5..5e12df5 100644 --- a/src/helsinki.at/rhimportd/ctrlWebSimple.go +++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go @@ -36,7 +36,6 @@ import ( type webSimpleRequestData struct { UserName string `json:"LOGIN_NAME"` Password string `json:"PASSWORD"` - GroupName string `json:"GROUP_NAME"` Cart uint `json:"CART_NUMBER"` Cut uint `json:"CUT_NUMBER"` Channels uint `json:"CHANNELS"` @@ -84,7 +83,7 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted b if trusted { username = r.Header.Get("X-Forwarded-User") } - ctx = rhimport.NewImportContext(conf, rddb, username, reqdata.GroupName) + ctx = rhimport.NewImportContext(conf, rddb, username) ctx.Password = reqdata.Password ctx.Trusted = trusted ctx.Cart = reqdata.Cart @@ -108,9 +107,10 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool, return } - // TODO: add a sanity check for the context: - // it would be nice to know whether a request is bogus - // *before* we fetch a big file! + if err = ctx.SanityCheck(); err != nil { + webSimpleErrorResponse(w, http.StatusBadRequest, err.Error()) + return + } if err = rhimport.FetchFile(ctx); err != nil { webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error()) |