mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-24 22:19:09 -05:00
Clear accountUUID if it's still me after validation
This commit is contained in:
@@ -328,6 +328,10 @@ func getValidatedAccountUUID(c context.Context, accountUUID string) string {
|
||||
accountUUID = ownAccountUUID
|
||||
}
|
||||
}
|
||||
if accountUUID == "me" {
|
||||
// no matter what happens above, an accountUUID of `me` must not be passed on. Clear it instead.
|
||||
accountUUID = ""
|
||||
}
|
||||
return accountUUID
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,17 @@ var (
|
||||
expect: ctxWithUUID.Value(middleware.UUIDKey).(string),
|
||||
},
|
||||
{
|
||||
name: "context without UUID; identifier = 'me'",
|
||||
name: "context with empty UUID; identifier = 'me'",
|
||||
ctx: ctxWithEmptyUUID,
|
||||
accountUUID: "me",
|
||||
expect: "",
|
||||
},
|
||||
{
|
||||
name: "context without UUID; identifier = 'me'",
|
||||
ctx: emptyCtx,
|
||||
accountUUID: "me",
|
||||
expect: "",
|
||||
},
|
||||
{
|
||||
name: "context with UUID; identifier not 'me'",
|
||||
ctx: ctxWithUUID,
|
||||
|
||||
Reference in New Issue
Block a user