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:

[http://www.foo.com/stuff?url=^attachment.ext]

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:

{run-now:replace=url:[^attachment.ext]}
[Test | h t t p://www.foo.com/stuff?url=$url]
{run-now}

Can anyone suggest another approach?

Thanks!

Tim

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://www.foo.com/stuff?url=<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://www.foo.com/stuff?url=^attachment.ext]</span>

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

<a ... href="h t t p://www.foo.com/stuff?url=h 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 Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,168 views 4 6
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