Skip to content

Commit 6e4426a

Browse files
authored
Handle authed media endpoint (#731)
1 parent 5d64767 commit 6e4426a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

federation/handle.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ func HandleKeyRequests() func(*Server) {
471471
func HandleMediaRequests(mediaIds map[string]func(w http.ResponseWriter)) func(*Server) {
472472
return func(srv *Server) {
473473
mediamux := srv.mux.PathPrefix("/_matrix/media").Subrouter()
474+
mediamuxAuthenticated := srv.mux.PathPrefix("/_matrix/federation/v1/media").Subrouter()
474475

475476
downloadFn := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
476477
vars := mux.Vars(req)
@@ -497,6 +498,9 @@ func HandleMediaRequests(mediaIds map[string]func(w http.ResponseWriter)) func(*
497498
mediamux.Handle("/r0/download/{origin}/{mediaId}", downloadFn).Methods("GET")
498499
mediamux.Handle("/v1/download/{origin}/{mediaId}", downloadFn).Methods("GET")
499500
mediamux.Handle("/v3/download/{origin}/{mediaId}", downloadFn).Methods("GET")
501+
502+
// Also handle authenticated media requests
503+
mediamuxAuthenticated.Handle("/download/{mediaId}", downloadFn).Methods("GET")
500504
}
501505
}
502506

0 commit comments

Comments
 (0)