aboutsummaryrefslogtreecommitdiff
path: root/mediaapi/routing/routing.go
diff options
context:
space:
mode:
Diffstat (limited to 'mediaapi/routing/routing.go')
-rw-r--r--mediaapi/routing/routing.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/mediaapi/routing/routing.go b/mediaapi/routing/routing.go
index 71804606..13f84c33 100644
--- a/mediaapi/routing/routing.go
+++ b/mediaapi/routing/routing.go
@@ -32,6 +32,7 @@ import (
)
const pathPrefixR0 = "/media/r0"
+const pathPrefixV1 = "/media/v1" // TODO: remove when synapse is fixed
// Setup registers the media API HTTP handlers
//
@@ -46,6 +47,7 @@ func Setup(
client *gomatrixserverlib.Client,
) {
r0mux := publicAPIMux.PathPrefix(pathPrefixR0).Subrouter()
+ v1mux := publicAPIMux.PathPrefix(pathPrefixV1).Subrouter()
activeThumbnailGeneration := &types.ActiveThumbnailGeneration{
PathToResult: map[string]*types.ThumbnailGenerationResult{},
@@ -60,9 +62,11 @@ func Setup(
activeRemoteRequests := &types.ActiveRemoteRequests{
MXCToResult: map[string]*types.RemoteRequestResult{},
}
- r0mux.Handle("/download/{serverName}/{mediaId}",
- makeDownloadAPI("download", cfg, db, client, activeRemoteRequests, activeThumbnailGeneration),
- ).Methods(http.MethodGet, http.MethodOptions)
+
+ downloadHandler := makeDownloadAPI("download", cfg, db, client, activeRemoteRequests, activeThumbnailGeneration)
+ r0mux.Handle("/download/{serverName}/{mediaId}", downloadHandler).Methods(http.MethodGet, http.MethodOptions)
+ v1mux.Handle("/download/{serverName}/{mediaId}", downloadHandler).Methods(http.MethodGet, http.MethodOptions) // TODO: remove when synapse is fixed
+
r0mux.Handle("/thumbnail/{serverName}/{mediaId}",
makeDownloadAPI("thumbnail", cfg, db, client, activeRemoteRequests, activeThumbnailGeneration),
).Methods(http.MethodGet, http.MethodOptions)