mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-25 14:30:28 -05:00
add defensive code on type assertion
This commit is contained in:
@@ -115,14 +115,15 @@ func getFailsafeIdentifier(c context.Context, identifier *proto.Identifier) *pro
|
||||
identifier = &proto.Identifier{}
|
||||
}
|
||||
if identifier.AccountUuid == "me" {
|
||||
ownAccountUUID := c.Value(middleware.UUIDKey).(string)
|
||||
if len(ownAccountUUID) > 0 {
|
||||
identifier.AccountUuid = ownAccountUUID
|
||||
} else {
|
||||
// might be valid for the request not having an AccountUuid in the identifier.
|
||||
// but clear it, instead of passing on `me`.
|
||||
identifier.AccountUuid = ""
|
||||
ownAccountUUID, ok := c.Value(middleware.UUIDKey).(string)
|
||||
if ok {
|
||||
if len(ownAccountUUID) > 0 {
|
||||
identifier.AccountUuid = ownAccountUUID
|
||||
}
|
||||
}
|
||||
// might be valid for the request not having an AccountUuid in the identifier.
|
||||
// but clear it, instead of passing on `me`.
|
||||
identifier.AccountUuid = ""
|
||||
}
|
||||
identifier.AccountUuid = strings.ToLower(identifier.AccountUuid)
|
||||
return identifier
|
||||
|
||||
Reference in New Issue
Block a user