Attachment url as parameter in another url

I'm trying to build a Link that contains a parameter which is the URL of an attachment. Something like this:


I don't have access to user macros and I don't have control over the installed plugins, so I'm working with a mostly stock Confluence 3.5 install. I don't have the Script plugin, but I do have the Run plugin. I've tried a few things with the Run plugin, but I can't quite get what I want. For example:

[Test | h t t p://$url]

Can anyone suggest another approach?



3 answers

0 votes
Joe Clark Atlassian Team Dec 20, 2011

So the problem with your current approach is that you just want the filename and extension, rather than the full absolute URL to the attachment?

I do want the full absolute URL, and that is actually what I'm getting. But what I also want is that URL to be interpolated into a hyperlink. The problem that I'm running into is that I can't get the hyperlink to work properly.

If I use "replace=url:[^attachment.ext]" then the hyperlink isn't formed correctly, (i.e. this is the generated HTML):

[Test | h t t p://<a href="/download/attachments/12345/attachment.ext?version=1&...>attachment.ext</a>

If I use "replace=url:^attachment.ext" then the hyperlink results in an error:

<span class="error">[Test | h t t p://^attachment.ext]</span>

Ultimately what i want is for the HTML to look something like this:

<a ... href="h t t p:// t t p://confluence/download/attachments/12345/attachment.ext?version=1&...">Test</a>

I'm not sure if this is possible with the Run plugin, but this is the best approach that I've found so far.

[The "h t t p" above is my attempt to avoid parse errors in OSQA - read those as "http"]

0 votes
Joe Clark Atlassian Team Dec 20, 2011

I'm not sure if that's going to be possible or not :-( It seems like the run macro is a good approach if you don't have the ability to customise Confluence at all or install any plugins.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,349 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you