mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
fix context for cloud confluence
This commit is contained in:
parent
2336029fee
commit
6b080ecf7f
@ -61,6 +61,7 @@ type AttachmentInfo struct {
|
|||||||
Comment string `json:"comment"`
|
Comment string `json:"comment"`
|
||||||
} `json:"metadata"`
|
} `json:"metadata"`
|
||||||
Links struct {
|
Links struct {
|
||||||
|
Context string `json:"context"`
|
||||||
Download string `json:"download"`
|
Download string `json:"download"`
|
||||||
} `json:"_links"`
|
} `json:"_links"`
|
||||||
}
|
}
|
||||||
@ -320,6 +321,9 @@ func getAttachmentPayload(name, comment, path string) (*form, error) {
|
|||||||
|
|
||||||
func (api *API) GetAttachments(pageID string) ([]AttachmentInfo, error) {
|
func (api *API) GetAttachments(pageID string) ([]AttachmentInfo, error) {
|
||||||
result := struct {
|
result := struct {
|
||||||
|
Links struct {
|
||||||
|
Context string `json:"context"`
|
||||||
|
} `json:"_links"`
|
||||||
Results []AttachmentInfo `json:"results"`
|
Results []AttachmentInfo `json:"results"`
|
||||||
}{}
|
}{}
|
||||||
|
|
||||||
@ -338,6 +342,14 @@ func (api *API) GetAttachments(pageID string) ([]AttachmentInfo, error) {
|
|||||||
return nil, newErrorStatusNotOK(request)
|
return nil, newErrorStatusNotOK(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i, info := range result.Results {
|
||||||
|
if info.Links.Context == "" {
|
||||||
|
info.Links.Context = result.Links.Context
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Results[i] = info
|
||||||
|
}
|
||||||
|
|
||||||
return result.Results, nil
|
return result.Results, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
@ -74,7 +75,10 @@ func ResolveAttachments(
|
|||||||
)
|
)
|
||||||
|
|
||||||
attach.ID = remote.ID
|
attach.ID = remote.ID
|
||||||
attach.Link = remote.Links.Download
|
attach.Link = path.Join(
|
||||||
|
remote.Links.Context,
|
||||||
|
remote.Links.Download,
|
||||||
|
)
|
||||||
|
|
||||||
found = true
|
found = true
|
||||||
|
|
||||||
@ -111,7 +115,10 @@ func ResolveAttachments(
|
|||||||
}
|
}
|
||||||
|
|
||||||
attach.ID = info.ID
|
attach.ID = info.ID
|
||||||
attach.Link = info.Links.Download
|
attach.Link = path.Join(
|
||||||
|
info.Links.Context,
|
||||||
|
info.Links.Download,
|
||||||
|
)
|
||||||
|
|
||||||
creating[i] = attach
|
creating[i] = attach
|
||||||
}
|
}
|
||||||
@ -134,7 +141,10 @@ func ResolveAttachments(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
attach.Link = info.Links.Download
|
attach.Link = path.Join(
|
||||||
|
info.Links.Context,
|
||||||
|
info.Links.Download,
|
||||||
|
)
|
||||||
|
|
||||||
updating[i] = attach
|
updating[i] = attach
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user