From 941fd8dd9ca49f2d622a3c2e79a22560c36f75e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 5 Sep 2017 11:56:28 +0200 Subject: [PATCH] Show max filesize of variations, rather than original file size. The original file isn't always accessible, and can be of completely different size than the downloadable variations. This is mostly appliccable to videos. --- pillar/web/nodes/routes.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pillar/web/nodes/routes.py b/pillar/web/nodes/routes.py index 2b997bbc..db5531ae 100644 --- a/pillar/web/nodes/routes.py +++ b/pillar/web/nodes/routes.py @@ -196,6 +196,10 @@ def view(node_id): if 'description' in node: node['description'] = attachments.render_attachments(node, node['description']) + # Overwrite the file length by the biggest variation, if any. + if node.file and node.file_variations: + node.file.length = max(var.length for var in node.file_variations) + if request.args.get('format') == 'json': node = node.to_dict() node['url_edit'] = url_for('nodes.edit', node_id=node['_id'])