Skip to content

Commit

Permalink
Merge pull request #1205 from mozilla/get-all-with-url-invalid
Browse files Browse the repository at this point in the history
Allow invalid urls in bookmarks_get_all_with_url. Fixes #1198
  • Loading branch information
Thom Chiovoloni authored May 28, 2019
2 parents 29d0d16 + 7a4a2c1 commit e957c3b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/places/ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,16 @@ pub extern "C" fn bookmarks_get_all_with_url(
) -> ByteBuffer {
log::debug!("bookmarks_get_all_with_url");
CONNECTIONS.call_with_result(error, handle, |conn| -> places::Result<_> {
Ok(BookmarkNodeList::from(
bookmarks::public_node::fetch_bookmarks_by_url(conn, &parse_url(url.as_str())?)?,
))
Ok(match parse_url(url.as_str()) {
Ok(url) => {
BookmarkNodeList::from(bookmarks::public_node::fetch_bookmarks_by_url(conn, &url)?)
}
Err(e) => {
// There are no bookmarks with the URL if it's invalid.
log::warn!("Invalid URL passed to bookmarks_get_all_with_url, {}", e);
BookmarkNodeList::from(Vec::<bookmarks::public_node::PublicNode>::new())
}
})
})
}

Expand Down

0 comments on commit e957c3b

Please sign in to comment.