diff --git a/pillar/shortcodes.py b/pillar/shortcodes.py
index 5a4a8c32..cdb93905 100644
--- a/pillar/shortcodes.py
+++ b/pillar/shortcodes.py
@@ -230,7 +230,7 @@ class Attachment:
from pillar.web import system_util
- attachments = node_properties.get('attachments', {})
+ attachments = node_properties.get('properties', {}).get('attachments', {})
attachment = attachments.get(slug)
if not attachment:
raise self.NoSuchSlug(slug)
diff --git a/tests/test_shortcodes.py b/tests/test_shortcodes.py
index 5535f466..1201ed46 100644
--- a/tests/test_shortcodes.py
+++ b/tests/test_shortcodes.py
@@ -187,11 +187,11 @@ class AttachmentTest(AbstractPillarTest):
],
'filename': 'cute_kitten.jpg',
})
- node_props = {
+ node_doc = {'properties': {
'attachments': {
'img': {'oid': oid},
}
- }
+ }}
# We have to get the file document again, because retrieving it via the
# API (which is what the shortcode rendering is doing) will change its
@@ -204,20 +204,20 @@ class AttachmentTest(AbstractPillarTest):
f'
'
self.assertEqual(
self_linked,
- render('{attachment img link}', context=node_props).strip()
+ render('{attachment img link}', context=node_doc).strip()
)
self.assertEqual(
self_linked,
- render('{attachment img link=self}', context=node_props).strip()
+ render('{attachment img link=self}', context=node_doc).strip()
)
self.assertEqual(
f'
',
- render('{attachment img}', context=node_props).strip()
+ render('{attachment img}', context=node_doc).strip()
)
tag_link = 'https://i.imgur.com/FmbuPNe.jpg'
self.assertEqual(
f''
f'
',
- render('{attachment img link=%r}' % tag_link, context=node_props).strip()
+ render('{attachment img link=%r}' % tag_link, context=node_doc).strip()
)