Getting images from same page as a content

Right now I am getting content from base/spaces/abc/pages/xyz which has data[‘id’] from response of ‘base:abc.xyz’ and the image from base/spaces/abc/pages/xyz/attachments where i do

        for each in data['attachments']:
             category = each['id']

which has category of ‘base:abc.xyz@file.jpg’… how do I link these together right now so that when i get a page I can find the images in that page

right now I am doing

match = re.match(r'(.*?)(?<!\\)@', category)
      if match:
          category = match.group(1) # to get category of 'base:abc.xyz

so that the image has the same id as the id of the page it is in and then find both.

BUT i am worried this is hardcoded, is it always the case that @ WITHOUT @ separates the filetype and the parent id of the page OR is this not standard and it was just the way this specific xwiki was configured?

Hello, See https://extensions.xwiki.org/xwiki/bin/view/Extension/Model%20Module#HAttachmentReferences for attachment reference format.

Hope it helps

Thank you! That is exactly what I needed!