-
-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix orderModelv2 for nullable profile column #7907
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,7 +400,7 @@ type orderModelv2 struct { | |
Error []byte | ||
CertificateSerial string | ||
BeganProcessing bool | ||
CertificateProfileName string | ||
CertificateProfileName *string | ||
} | ||
|
||
type orderToAuthzModel struct { | ||
|
@@ -464,7 +464,7 @@ func orderToModelv2(order *corepb.Order) (*orderModelv2, error) { | |
Created: order.Created.AsTime(), | ||
BeganProcessing: order.BeganProcessing, | ||
CertificateSerial: order.CertificateSerial, | ||
CertificateProfileName: order.CertificateProfileName, | ||
CertificateProfileName: &order.CertificateProfileName, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's surprising that the resulting It would be better to create a new string with a copy of the input, for avoidance of surprising behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsha That would look like this?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, that still results in a pointer that points to the original code. This is what I'm looking for:
|
||
} | ||
|
||
if order.Error != nil { | ||
|
@@ -481,14 +481,18 @@ func orderToModelv2(order *corepb.Order) (*orderModelv2, error) { | |
} | ||
|
||
func modelToOrderv2(om *orderModelv2) (*corepb.Order, error) { | ||
profile := "" | ||
if om.CertificateProfileName != nil { | ||
profile = *om.CertificateProfileName | ||
} | ||
order := &corepb.Order{ | ||
Id: om.ID, | ||
RegistrationID: om.RegistrationID, | ||
Expires: timestamppb.New(om.Expires), | ||
Created: timestamppb.New(om.Created), | ||
CertificateSerial: om.CertificateSerial, | ||
BeganProcessing: om.BeganProcessing, | ||
CertificateProfileName: om.CertificateProfileName, | ||
CertificateProfileName: profile, | ||
} | ||
if len(om.Error) > 0 { | ||
var problem corepb.ProblemDetails | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be an
orderModelv2
struct comment to match similar wording on thecrlShardModel
struct.