func (self *restContext) ReadBucketId(value *httpserver.Values, key string, optional bool) ( bucketId bucket.Id, bucketIdAsString string, status retcode.Status) { if optional { bucketIdAsString = value.OptionalString(key) if bucketIdAsString == "" { return } } else { bucketIdAsString, status = value.NonEmptyString(key) if !status.IsOk() { return } } bucketIdBytes, err := encoding.Base32Decode(bucketIdAsString) if err != nil { status = retcode.NewStatusFmt(retcode.ErrorClient, "Invalid bucket id given. The id "+ "has to be base32 without padding. Err: %v", err) return } bucketId = bucket.Id(bucketIdBytes) status = retcode.NewStatusOk() return }
func directorySubPath(params httpserver.Values, ctx *restContext) (ret []string) { ret = make([]string, 3) length := 0 if params.Has("p0") { ret[0] = params.OptionalString("p0") length = 1 if params.Has("p1") { ret[1] = params.OptionalString("p1") length = 2 if params.Has("p2") { ret[2] = params.OptionalString("p2") length = 3 } } } ret = ret[:length] return }