From 937a1db89fd53d54fbdba7b804707596e820a65f Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 15 Aug 2020 20:28:07 +0200 Subject: [PATCH] component file sharing: added `Access-Control-Expose-Headers` CORS header: without this header, the range header in response was not exposed to client. This could cause trouble is a javascript application was needing to access it. --- sat/plugins/plugin_comp_file_sharing.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sat/plugins/plugin_comp_file_sharing.py b/sat/plugins/plugin_comp_file_sharing.py index d881d4fe..6210b881 100644 --- a/sat/plugins/plugin_comp_file_sharing.py +++ b/sat/plugins/plugin_comp_file_sharing.py @@ -115,8 +115,15 @@ class HTTPFileServer(resource.Resource): def render(self, request): request.setHeader("Access-Control-Allow-Origin", "*") request.setHeader("Access-Control-Allow-Methods", "OPTIONS, HEAD, GET, PUT") - request.setHeader("Access-Control-Allow-Headers", "Content-Type, Xmpp-File-Path, Xmpp-File-No-Http") + request.setHeader( + "Access-Control-Allow-Headers", + "Content-Type, Range, Xmpp-File-Path, Xmpp-File-No-Http") request.setHeader("Access-Control-Allow-Credentials", "true") + request.setHeader("Accept-Ranges", "bytes") + + request.setHeader( + "Access-Control-Expose-Headers", + "Date, Content-Length, Content-Range") return super().render(request) def render_OPTIONS(self, request):