Nodes: embed 'short_link' when 'short_code' is present and not empty.

This prevents calls to /nodes/<node-id>/share to get the short link.
This commit is contained in:
2016-07-15 11:10:54 +02:00
parent 2d5a538ad6
commit 9b3e75b9b9
2 changed files with 26 additions and 0 deletions

View File

@@ -321,6 +321,10 @@ def before_returning_node(node):
# Run validation process, since GET on nodes entry point is public
check_permissions('nodes', node, 'GET', append_allowed_methods=True)
# Embed short_link_info if the node has a short_code.
short_code = node.get('short_code')
if short_code:
node['short_link'] = short_link_info(short_code)['short_link']
def before_returning_nodes(nodes):