From 319faede0703e17873de84f0d1bd1fbd9822ebd2 Mon Sep 17 00:00:00 2001 From: Egor Kovetskiy Date: Mon, 22 Apr 2019 14:01:01 +0300 Subject: [PATCH] fix context for cloud confluence when creating attach --- pkg/confluence/api.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pkg/confluence/api.go b/pkg/confluence/api.go index fea4f5b..2de1d6c 100644 --- a/pkg/confluence/api.go +++ b/pkg/confluence/api.go @@ -173,6 +173,9 @@ func (api *API) CreateAttachment( } var result struct { + Links struct { + Context string `json:"context"` + } `json:"_links"` Results []AttachmentInfo `json:"results"` } @@ -202,6 +205,14 @@ func (api *API) CreateAttachment( ) } + for i, info := range result.Results { + if info.Links.Context == "" { + info.Links.Context = result.Links.Context + } + + result.Results[i] = info + } + info = result.Results[0] return info, nil @@ -222,6 +233,9 @@ func (api *API) UpdateAttachment( } var result struct { + Links struct { + Context string `json:"context"` + } `json:"_links"` Results []AttachmentInfo `json:"results"` } @@ -251,6 +265,14 @@ func (api *API) UpdateAttachment( ) } + for i, info := range result.Results { + if info.Links.Context == "" { + info.Links.Context = result.Links.Context + } + + result.Results[i] = info + } + info = result.Results[0] return info, nil