mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Pass a context when downloading remote media (#251)
This commit is contained in:
parent
fef290c47e
commit
ce019738ff
6 changed files with 65 additions and 20 deletions
2
vendor/manifest
vendored
2
vendor/manifest
vendored
|
@ -116,7 +116,7 @@
|
|||
{
|
||||
"importpath": "github.com/matrix-org/gomatrixserverlib",
|
||||
"repository": "https://github.com/matrix-org/gomatrixserverlib",
|
||||
"revision": "ec5a0d21b03ed4d3bd955ecc9f7a69936f64391e",
|
||||
"revision": "40b35e1c997fc7e35342aeb39187ff6bf3e10b2e",
|
||||
"branch": "master"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -236,9 +236,15 @@ func (fc *Client) LookupServerKeys( // nolint: gocyclo
|
|||
}
|
||||
|
||||
// CreateMediaDownloadRequest creates a request for media on a homeserver and returns the http.Response or an error
|
||||
func (fc *Client) CreateMediaDownloadRequest(matrixServer ServerName, mediaID string) (*http.Response, error) {
|
||||
func (fc *Client) CreateMediaDownloadRequest(
|
||||
ctx context.Context, matrixServer ServerName, mediaID string,
|
||||
) (*http.Response, error) {
|
||||
requestURL := "matrix://" + string(matrixServer) + "/_matrix/media/v1/download/" + string(matrixServer) + "/" + mediaID
|
||||
resp, err := fc.client.Get(requestURL)
|
||||
req, err := http.NewRequest("GET", requestURL, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := fc.client.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue