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