cancel
Showing results for 
Search instead for 
Did you mean: 

Links containing http:// fail due to extra http//

jtp
Champ in-the-making
Champ in-the-making
I realize that's a heck of a title, but I'll explain.

1)  Create a link such as http://www.alfresco.com
2)  If you click on that link while it is in the list of all links, it works.
3)  Instead, click on the title so you reach the page where you could comment on the link.
4)  Now click on the URL; the link will look like http://http//www.alfresco.com

I believe it has to do with this section of code in
C:\Alfresco\tomcat\webapps\share\components\links\linksview.js
but I'm not sure how it works.

         // Link details
         html += '<div class="nodeContent">';
         html += '<div class="nodeTitle"><a href="' + linksViewUrl + '">' + $html(data.title) + '</a></div>';

         html += '<div class="nodeURL">';
         html += '<span class="nodeAttrLabel">' + this._msg("link.url") + ": </span><a " + (data.internal ? "" : "target='_blank' class='external'") + " href='" + (data.url.substring(0, 1) != '/' || data.url.indexOf("://") == -1 ? 'http://' : '') + data.url + "'>" + $html(data.url) + '</a>';
         html += '</div>';

Did I find something new or am I just crazy?
7 REPLIES 7

mikeh
Star Contributor
Star Contributor
Hi

Our QA team spotted it too: https://issues.alfresco.com/jira/browse/ALFCOM-2462

It's not been merged to HEAD yet (we'll be doing that soon)

That code should read:
         html += '<span class="nodeAttrLabel">' + this._msg("link.url") + ": </span><a " + (data.internal ? "" : "target='_blank' class='external'") + " href='" + (data.url.substring(0, 1) === "/" || data.url.indexOf("://") !== -1 ? '' : "http://") + data.url + "'>" + $html(data.url) + '</a>';

Thanks,
Mike

jtp
Champ in-the-making
Champ in-the-making
Thank you for the code so I can apply it myself.  I appreciate not having to do a full upgrade to fix the little things.

fselendic
Champ in-the-making
Champ in-the-making
Also noticed that one, but it gets even funnier when combined with Word2003.

Seems that Word expects links to start with http://, so it doesn't want to open links created with Share that don't have "http://".
Also, links created in Word don't work in Share because of mentioned double http.

jtp
Champ in-the-making
Champ in-the-making
I confirmed that the code fix posted will fix the issue.

mikeh
Star Contributor
Star Contributor
Seems that Word expects links to start with http://, so it doesn't want to open links created with Share that don't have "http://".
I'm not sure I understand this one - how is Word getting hold of Share links?

Thanks,
Mike

fselendic
Champ in-the-making
Champ in-the-making
Seems that Word expects links to start with http://, so it doesn't want to open links created with Share that don't have "http://".
I'm not sure I understand this one - how is Word getting hold of Share links?

Thanks,
Mike

Sorry, wasn't clear enough, when working with Alfresco sharepoint emulation/implementation, there is Links tab in Shared Workspace pane in Word.

When you create link there, it wont work in Share, because of the bug mentioned (it will have double http in Share).
When you create link in Share that doesn't have http (http://www.something.com), it won't work in Word Shared Workspace, because it expects http in front of it.

Any clearer?  Smiley Very Happy

mikeh
Star Contributor
Star Contributor
Ah ok - thanks. I'll take a look.

Mike