Remove firefox bookmark with no title

This commit is contained in:
Hongtao Zhang 2022-01-08 16:31:28 -06:00
parent 9fc0e03b3d
commit 50144ea8f4

View file

@ -9,10 +9,10 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
{
public class FirefoxBookmarkLoader : IBookmarkLoader
{
private const string queryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title
private const string QueryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title
FROM moz_places
INNER JOIN moz_bookmarks ON (
moz_bookmarks.fk NOT NULL AND moz_bookmarks.fk = moz_places.id
moz_bookmarks.fk NOT NULL AND moz_bookmarks.title NOT NULL AND moz_bookmarks.fk = moz_places.id
)
ORDER BY moz_places.visit_count DESC
";
@ -32,18 +32,16 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
// create the connection string and init the connection
string dbPath = string.Format(dbPathFormat, PlacesPath);
using (var dbConnection = new SQLiteConnection(dbPath))
{
// Open connection to the database file and execute the query
dbConnection.Open();
var reader = new SQLiteCommand(queryAllBookmarks, dbConnection).ExecuteReader();
using var dbConnection = new SQLiteConnection(dbPath);
// Open connection to the database file and execute the query
dbConnection.Open();
var reader = new SQLiteCommand(QueryAllBookmarks, dbConnection).ExecuteReader();
// return results in List<Bookmark> format
bookmarkList = reader.Select(
x => new Bookmark(x["title"] is DBNull ? string.Empty : x["title"].ToString(),
x["url"].ToString())
).ToList();
}
// return results in List<Bookmark> format
bookmarkList = reader.Select(
x => new Bookmark(x["title"] is DBNull ? string.Empty : x["title"].ToString(),
x["url"].ToString())
).ToList();
return bookmarkList;
}