Skip to content

Commit 50144ea

Browse files
committed
Remove firefox bookmark with no title
1 parent 9fc0e03 commit 50144ea

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ namespace Flow.Launcher.Plugin.BrowserBookmark
99
{
1010
public class FirefoxBookmarkLoader : IBookmarkLoader
1111
{
12-
private const string queryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title
12+
private const string QueryAllBookmarks = @"SELECT moz_places.url, moz_bookmarks.title
1313
FROM moz_places
1414
INNER JOIN moz_bookmarks ON (
15-
moz_bookmarks.fk NOT NULL AND moz_bookmarks.fk = moz_places.id
15+
moz_bookmarks.fk NOT NULL AND moz_bookmarks.title NOT NULL AND moz_bookmarks.fk = moz_places.id
1616
)
1717
ORDER BY moz_places.visit_count DESC
1818
";
@@ -32,18 +32,16 @@ public List<Bookmark> GetBookmarks()
3232

3333
// create the connection string and init the connection
3434
string dbPath = string.Format(dbPathFormat, PlacesPath);
35-
using (var dbConnection = new SQLiteConnection(dbPath))
36-
{
37-
// Open connection to the database file and execute the query
38-
dbConnection.Open();
39-
var reader = new SQLiteCommand(queryAllBookmarks, dbConnection).ExecuteReader();
40-
41-
// return results in List<Bookmark> format
42-
bookmarkList = reader.Select(
43-
x => new Bookmark(x["title"] is DBNull ? string.Empty : x["title"].ToString(),
44-
x["url"].ToString())
45-
).ToList();
46-
}
35+
using var dbConnection = new SQLiteConnection(dbPath);
36+
// Open connection to the database file and execute the query
37+
dbConnection.Open();
38+
var reader = new SQLiteCommand(QueryAllBookmarks, dbConnection).ExecuteReader();
39+
40+
// return results in List<Bookmark> format
41+
bookmarkList = reader.Select(
42+
x => new Bookmark(x["title"] is DBNull ? string.Empty : x["title"].ToString(),
43+
x["url"].ToString())
44+
).ToList();
4745

4846
return bookmarkList;
4947
}

0 commit comments

Comments
 (0)