Can I no longer use the Attachment and Include macros together?
Asked by epohl:

In the old days (pre- new editor) I could use the Attachments macro on Page A to show all of the page's attachments in a nice list.

I could then use the Include macro on Page B to show Page A's attachment list on Page B.

In the new editor, when I include page A on Page B, the message says, "There are currently no attachments on this page."

It seems that instead of including the rendered macro as a part of Page A, it renders it as though it is present on Page B.

Is there a workaround for this?

The Include macro now also seems to have issues with internal links to pages in other spaces, but that's probably a separate question.


Answers:
author: Thomas Wynne
body: I just upgraded my advanced macros to the latest version.. I think it was 2.0.34 and the problem is now resolved.

comments: author: Paul Curren
body: Great. I put 2.0.34 on [plugins.atlassian.com](http://plugins.atlassian.com) and removed the broken versions.


author: Paul Curren
body: The problem being reported definitely exists but only on certain versions of the confluence-advanced-macros. Specifically versions 2.0.30 - 2.0.33.

No versions of Confluence shipped with any of these versions of advanced-macros. Confluence 4.1.1 is the only build affected since it uses version 2.0.32 although version 4.1.1 of Confluence was never shipped.

Could it be that the people experiencing the problem have upraded their confluence-advanced-macros to one of the broken versions?


author: Thomas Wynne
body: This problem just happened to me. We upgraded from 4.0 to 4.1 a week ago then went on vacation for the holidays came back and this is what happened.

1. Pulled up the page that has the includes in it (the includes have attached pictures) and everything looks fine.

2. I had to make an update to the base page that has the attachment, it was a text/content update that had nothing to do with the attachment.

3. Saved the base page, the attachment/image looks fine on the page.

4. Pulled up the page that has the includes in it and the image does not come up, it says Unknown Attachment.

Note that my main page has anywhere between 5 and 20 includes in it... think of it as a big list. When I first pulled up the page all the images showed from the included pages.. after updating only 1 base page with the attachement though, none of them come up. Now when I look at the main page all of the included pages say Unknown Attachment for the image.

Hope this helps.


author: Matt
body: I just tested this on Confluence 4.1 and the issue appears to be fixed.

Attachments of Page B, which has the Attachments macro on it, display on Page A which is including Pabe B with the Include macro.

comments: author: epohl
body: OK, there's one twist. The two pages are in different spaces. Does that work for you. I didn't think about it before, but that could very well be the problem.


author: Andrew Frayling
body: Tried on 4.0.3 and 4.0.4 with pages in different spaces (Page A with {attachments} in TEST, Page B in TEST2 with {include}) and it worked for both versions.

The only way I could get it to not display the attachments on Page B was to change the permissions on TEST which I tried by changing the permissions at the Space level so the user with access to TEST2 (Page B) did not have access to TEST (Page A), and a separate test allowing the user access to both spaces, but setting page level restrictions on Page A so that only the admin user had access to view and edit Page A. In both cases this generated "Unable to render {include} The included page could not be found." which is what I would expect.

Not sure what else to suggest. Is it an upgrade issue, i.e. are you only seeing this behaviour on existing pages that have been upgraded to 4.0.4 or are you also seeing it on new pages that you have created post-upgrade? Do you see the same behaviour using {excerpt-include}? Does Page A with the attachments on it render properly on it's own, i.e. someone hasn't deleted the attachments or changed the filter so the attachments macro doesn't match any attachments on the Page A any more?


author: Andrew Frayling
body: Hi,

I just tried this on Confluence 4.1 and it works. I created a Page A with 3 attachments on it and a Page B with an {include} for Page A and on Page B it shows the same 3 attachments.

Which version of Confluence are you using? Looks like the behaviour you're seeing has been reported for 4.0.3 - <https://jira.atlassian.com/browse/CONF-24157>

Andrew.

comments: author: epohl
body: Hmmm...yeah, I'm using version 4.0.4.

Are you using the attachments macro on page A, or linking to the attachments?


author: Andrew Frayling
body: I'm using the attachments macro on Page A to display the list of attachments.

I just tried again on 4.0.4 this time, but it's working for me on this verison as well. Not sure if I'm doing anything different to yourself, but in case it helps here's what I did:

1. Created Page A  
2. Selected Insert -\> Attachment  
3. Attached a file  
4. Repeated steps 2 + 3 another two times so there were 3 attachments on the page  
5. Saved Page A  
6. Edited Page A and inserted the {attachments} macro using autocomplete  
7. Saved Page A  
8. Created Page B  
9. Inserted {include} macro using autocomplete into Page B  
10. In the Edit Include Page macro dialogue started typing Page A in the Page to include field  
11. Selected Page A from the list of suggested pages  
12. Clicked Refresh in the preview pane of the Edit Include Page macro dialogue (which showed the 3 attachments of Page A)  
13. Clicked Insert  
14. Clicked Preview (again it showed the 3 attachments from Page A)  
15. Clicked Edit, then clicked Save

I'm guessing this is the same as you're doing, but maybe there's an extra step (the Refresh at step 12 possibly) that's making it work for me?

If it's still not working for you using a full page include, how about using {excerpt} on Page A and the excerpt include macro on Page B. Does that work?

Hope this is of some help?

Andrew.


author: Andrew Frayling
body: Tried this again on 4.0.3 (the version that was reported to have the problem at <https://jira.atlassian.com/browse/CONF-24157>) and I cannot reproduce the problem. I created a Page A with 3 attachments, a Page B with no content and used the {include} macro on Page B to display the attachments from Page A and it worked.

I also tried combinations of the pages in the same space with and without the SPACEKEY in the {include} macro and creating Page A in space TEST, Page B in space TEST2 and referencing TEST:Page A in the {include} macro in Page B and they all worked.

Only thing I can think of now is if this is an upgrade problem? I.e. you have existing {includes} in Confluence 3.5.x that have broken on the upgrade to 4.0.4?