Skip to content

Commit

Permalink
Add allow_redirect query parameter to relevant media endpoints (#1529)
Browse files Browse the repository at this point in the history
* Add `allow_redirect` query parameter to relevant media endpoints

* Add added in version flag to `allow_redirect` params

* Add 307/308 responses to media endpoints

* Add changelogs
  • Loading branch information
Fizzadar authored May 17, 2023
1 parent 466acdf commit 4fabef1
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1529.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Addition of redirect downloads, as per [MSC3860](https://github.com/matrix-org/matrix-spec-proposals/pull/3860).
69 changes: 69 additions & 0 deletions data/api/client-server/content-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ paths:
content repository can and should impose a maximum value for this
parameter. The content repository may also choose to respond before
the timeout.
- in: query
type: boolean
name: allow_redirect
x-addedInMatrixVersion: "1.7"
x-example: false
required: false
default: false
description: |
Indicates to the server that it may return a 307 or 308 redirect response that points
at the relevant media content. When not explicitly set to true the server must return
the media content itself.
responses:
200:
description: "The content that was previously uploaded."
Expand All @@ -323,6 +334,18 @@ paths:
type: file
# This is a workaround for us not being able to say the response is required.
description: "**Required.** The bytes for the uploaded file."
307:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
308:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
429:
description: This request was rate-limited.
schema:
Expand Down Expand Up @@ -404,6 +427,17 @@ paths:
content repository can and should impose a maximum value for this
parameter. The content repository may also choose to respond before
the timeout.
- in: query
type: boolean
name: allow_redirect
x-addedInMatrixVersion: "1.7"
x-example: false
required: false
default: false
description: |
Indicates to the server that it may return a 307 or 308 redirect response that points
at the relevant media content. When not explicitly set to true the server must return
the media content itself.
responses:
200:
description: "The content that was previously uploaded."
Expand All @@ -420,6 +454,18 @@ paths:
type: file
# This is a workaround for us not being able to say the response is required.
description: "**Required.** The bytes for the uploaded file."
307:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
308:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
429:
description: This request was rate-limited.
schema:
Expand Down Expand Up @@ -518,6 +564,17 @@ paths:
content repository can and should impose a maximum value for this
parameter. The content repository may also choose to respond before
the timeout.
- in: query
type: boolean
name: allow_redirect
x-addedInMatrixVersion: "1.7"
x-example: false
required: false
default: false
description: |
Indicates to the server that it may return a 307 or 308 redirect response that points
at the relevant media content. When not explicitly set to true the server must return
the media content itself.
responses:
200:
description: "A thumbnail of the requested content."
Expand All @@ -530,6 +587,18 @@ paths:
type: file
# This is a workaround for us not being able to say the response is required.
description: "**Required.** The bytes for the thumbnail."
307:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
308:
description: "A redirect to the thumbnail of the requested content."
headers:
Location:
description: "The URL of the thumbnail content."
type: "string"
400:
description: |-
The request does not make sense to the server, or the server cannot thumbnail
Expand Down

0 comments on commit 4fabef1

Please sign in to comment.