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 vote
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 vote
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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Confluence

Three common content challenges + how to manage them

An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough   cough, all companies). If content calendars, marketing plans, and bu...

40 views 0 4
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