summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Hunt <will@half-shot.uk>2018-05-03 16:59:16 +0100
committerWill Hunt <will@half-shot.uk>2018-05-03 17:30:10 +0100
commit39763527b0c343c5f373e4362fe68f354cb1f9d5 (patch)
tree2304dff76328bc2fcc0278c9d0ed683f33a8d316
parentAdd GET media/v1/limits (diff)
downloadsynapse-39763527b0c343c5f373e4362fe68f354cb1f9d5.tar.xz
size > upload_size as per spec feedback
-rw-r--r--synapse/rest/media/v1/limits_resource.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/synapse/rest/media/v1/limits_resource.py b/synapse/rest/media/v1/limits_resource.py
index d36b243099..7f936d150d 100644
--- a/synapse/rest/media/v1/limits_resource.py
+++ b/synapse/rest/media/v1/limits_resource.py
@@ -12,12 +12,10 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-
-import synapse.http.servlet
-
+#
 from twisted.web.server import NOT_DONE_YET
 from twisted.web.resource import Resource
-from synapse.http.server import respond_with_json
+from synapse.http.server import respond_with_json, respond_with_json_bytes
 
 
 class MediaLimitsResource(Resource):
@@ -27,8 +25,12 @@ class MediaLimitsResource(Resource):
         Resource.__init__(self)
         self.limits_dict = {}
         config = hs.get_config()
-        self.limits_dict["size"] = config.max_upload_size
+        self.limits_dict["upload_size"] = config.max_upload_size
 
     def render_GET(self, request):
-        respond_with_json(request, 200, self.limits_dict)
+        respond_with_json(request, 200, self.limits_dict, send_cors=True)
+        return NOT_DONE_YET
+
+    def render_OPTIONS(self, request):
+        respond_with_json_bytes(request, 200, {}, send_cors=True)
         return NOT_DONE_YET