Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bookmarks: don’t show protocol #393

Closed
wants to merge 2 commits into from

4 participants

@raghunayyar
Collaborator

Tried again to fix #144

@raghunayyar
Collaborator

Have a look @jancborchardt @eMerzh and let me know.

Thanks

@eMerzh eMerzh was assigned
@jancborchardt
Collaborator

@raghunayyar @eMerzh quickly tested this and has some errors: When I try to add, say, »github.com« or »owncloud.com« or any address without the protocol, the resulting bookmark will link to http://localhost/owncloud/index.php/apps/github.com and have »301 Moved Permanently« as the fetched title.

@raghunayyar
Collaborator

@jancborchardt I was getting this error even before I started fixing the protocol bug. The "301 Moved" on google.com or gmail.com. I thought someone might be fixing it, I don't think it has got anything related to what I pushed. Please correct me if I am being wrong.

Thanks!

@owncloud-bot
Collaborator

Can one of the admins verify this patch?

@eMerzh
Collaborator

Hi Thanks for your PR,

the thing is that within a previous modifications we (you?) removed the URL from the bookmarks list.
So the #144 should be closed ...

and by the way, you patch only remove the protocol from the real links (used in the template) so when you click on a link you will always go to owncloud instead of the real site.

So I close this PR ;)

PS: jan, i've open another issue for the redirect part (which is not related to this code)

@eMerzh eMerzh closed this
@raghunayyar
Collaborator

@eMerzh it never went to ownCloud when I tested it for quite a many links. ;)
It's fine to close this bug anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 25, 2012
  1. @raghunayyar

    Bookmarks: don’t show protocol

    raghunayyar authored
    Protocols not shown in edit window or the heading.
  2. @raghunayyar

    Minor Indentation Error.

    raghunayyar authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +6 −5 bookmarks/js/bookmarks.js
View
11 bookmarks/js/bookmarks.js
@@ -267,10 +267,12 @@ function updateBookmarksList(bookmark, position) {
if(tags[i] != '')
taglist = taglist + '<a class="bookmark_tag" href="#">' + encodeEntities(tags[i]) + '</a> ';
}
- if(!hasProtocol(bookmark.url)) {
- bookmark.url = 'http://' + bookmark.url;
- }
+ if (hasProtocol(bookmark.url)) {
+ var entry = /(https|http|ftp|sftp)/;
+ bookmark.url = bookmark.url.replace(entry, '');
+ bookmark.url = bookmark.url.replace('://', '');
+ }
if(bookmark.added) {
bookmark.added_date.setTime(parseInt(bookmark.added)*1000);
}
@@ -322,7 +324,7 @@ function encodeEntities(s){
function hasProtocol(url) {
var regexp = /(ftp|http|https|sftp)/;
- return regexp.test(url);
+ return regexp.test(url);
}
function renameTag(event) {
@@ -382,4 +384,3 @@ function deleteTag(event){
}
});
}
-
Something went wrong with that request. Please try again.