Issue #252: Remove the hack from Type Converter
This commit is contained in:
parent
34bad37ab0
commit
b0cb08e49a
|
|
@ -59,17 +59,12 @@ func (tc BoulderTypeConverter) FromDb(target interface{}) (gorp.CustomScanner, b
|
||||||
if !ok {
|
if !ok {
|
||||||
return errors.New("FromDb: Unable to convert *string")
|
return errors.New("FromDb: Unable to convert *string")
|
||||||
}
|
}
|
||||||
|
if *s == "" {
|
||||||
|
return errors.New("FromDb: Empty JWK field.")
|
||||||
|
}
|
||||||
b := []byte(*s)
|
b := []byte(*s)
|
||||||
k := target.(*jose.JsonWebKey)
|
k := target.(*jose.JsonWebKey)
|
||||||
if *s != "" {
|
return k.UnmarshalJSON(b)
|
||||||
return k.UnmarshalJSON(b)
|
|
||||||
} else {
|
|
||||||
// HACK: Sometimes we can have an empty string the in the DB where a
|
|
||||||
// key should be. We should fix that (see HACK above). In the meantime,
|
|
||||||
// return the default JsonWebKey in such situations.
|
|
||||||
// https://github.com/letsencrypt/boulder/issues/181
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return gorp.CustomScanner{Holder: new(string), Target: target, Binder: binder}, true
|
return gorp.CustomScanner{Holder: new(string), Target: target, Binder: binder}, true
|
||||||
case *core.AcmeStatus:
|
case *core.AcmeStatus:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue