diff options
Diffstat (limited to 'src/bookmarks.c')
-rw-r--r-- | src/bookmarks.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c index 1f887c98..65cc7982 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c | |||
@@ -158,6 +158,7 @@ void load_Bookmarks(iBookmarks *d, const char *dirPath) { | |||
158 | appendChar_String(&bm->url, '/'); | 158 | appendChar_String(&bm->url, '/'); |
159 | } | 159 | } |
160 | stripDefaultUrlPort_String(&bm->url); | 160 | stripDefaultUrlPort_String(&bm->url); |
161 | set_String(&bm->url, canonicalUrl_String(&bm->url)); | ||
161 | } | 162 | } |
162 | nextSplit_Rangecc(src, "\n", &line); | 163 | nextSplit_Rangecc(src, "\n", &line); |
163 | setRange_String(&bm->title, line); | 164 | setRange_String(&bm->title, line); |
@@ -201,7 +202,7 @@ uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, | |||
201 | iChar icon) { | 202 | iChar icon) { |
202 | lock_Mutex(d->mtx); | 203 | lock_Mutex(d->mtx); |
203 | iBookmark *bm = new_Bookmark(); | 204 | iBookmark *bm = new_Bookmark(); |
204 | set_String(&bm->url, url); | 205 | set_String(&bm->url, canonicalUrl_String(url)); |
205 | set_String(&bm->title, title); | 206 | set_String(&bm->title, title); |
206 | if (tags) { | 207 | if (tags) { |
207 | set_String(&bm->tags, tags); | 208 | set_String(&bm->tags, tags); |
@@ -298,6 +299,7 @@ static iBool matchUrl_(void *url, const iBookmark *bm) { | |||
298 | 299 | ||
299 | uint32_t findUrl_Bookmarks(const iBookmarks *d, const iString *url) { | 300 | uint32_t findUrl_Bookmarks(const iBookmarks *d, const iString *url) { |
300 | /* TODO: O(n), boo */ | 301 | /* TODO: O(n), boo */ |
302 | url = canonicalUrl_String(url); | ||
301 | const iPtrArray *found = list_Bookmarks(d, NULL, matchUrl_, (void *) url); | 303 | const iPtrArray *found = list_Bookmarks(d, NULL, matchUrl_, (void *) url); |
302 | if (isEmpty_PtrArray(found)) return 0; | 304 | if (isEmpty_PtrArray(found)) return 0; |
303 | return id_Bookmark(constFront_PtrArray(found)); | 305 | return id_Bookmark(constFront_PtrArray(found)); |
@@ -448,7 +450,7 @@ void requestFinished_Bookmarks(iBookmarks *d, iGmRequest *req) { | |||
448 | const iRangecc url = capturedRange_RegExpMatch(&m, 1); | 450 | const iRangecc url = capturedRange_RegExpMatch(&m, 1); |
449 | const iRangecc title = capturedRange_RegExpMatch(&m, 3); | 451 | const iRangecc title = capturedRange_RegExpMatch(&m, 3); |
450 | iString * urlStr = newRange_String(url); | 452 | iString * urlStr = newRange_String(url); |
451 | const iString *absUrl = absoluteUrl_String(url_GmRequest(req), urlStr); | 453 | const iString *absUrl = canonicalUrl_String(absoluteUrl_String(url_GmRequest(req), urlStr)); |
452 | if (!findUrl_Bookmarks(d, absUrl)) { | 454 | if (!findUrl_Bookmarks(d, absUrl)) { |
453 | iString *titleStr = newRange_String(title); | 455 | iString *titleStr = newRange_String(title); |
454 | if (isEmpty_String(titleStr)) { | 456 | if (isEmpty_String(titleStr)) { |