From 22513afe88a0227a231160a4996f1442f17a8fd2 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 2 Mar 2021 10:48:23 +0000 Subject: [PATCH] Fix panic, hopefully --- keyserver/internal/internal.go | 7 +------ userapi/internal/api.go | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/keyserver/internal/internal.go b/keyserver/internal/internal.go index a603323ef..2ce18fa55 100644 --- a/keyserver/internal/internal.go +++ b/keyserver/internal/internal.go @@ -513,12 +513,7 @@ func (a *KeyInternalAPI) uploadLocalDeviceKeys(ctx context.Context, req *api.Per } func (a *KeyInternalAPI) uploadOneTimeKeys(ctx context.Context, req *api.PerformUploadKeysRequest, res *api.PerformUploadKeysResponse) { - if req.UserID == "" || req.DeviceID == "" { - res.Error = &api.KeyError{ - Err: "user ID or device ID missing", - } - } - if len(req.OneTimeKeys) == 0 { + if req.UserID != "" && req.DeviceID != "" && len(req.OneTimeKeys) == 0 { counts, err := a.DB.OneTimeKeysCount(ctx, req.UserID, req.DeviceID) if err != nil { res.Error = &api.KeyError{ diff --git a/userapi/internal/api.go b/userapi/internal/api.go index d8af5433d..dce8b5051 100644 --- a/userapi/internal/api.go +++ b/userapi/internal/api.go @@ -161,6 +161,7 @@ func (a *UserInternalAPI) deviceListUpdate(userID string, deviceIDs []string) er var uploadRes keyapi.PerformUploadKeysResponse a.KeyAPI.PerformUploadKeys(context.Background(), &keyapi.PerformUploadKeysRequest{ + UserID: userID, DeviceKeys: deviceKeys, }, &uploadRes) if uploadRes.Error != nil {