The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Attachment url as parameter in another url

Tim Pesce
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 20, 2011

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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.

0 votes
Tim Pesce
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 20, 2011

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
Atlassian Team members are employees working across the company in a wide variety of roles.
December 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?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events