Skip to content

Commit fdfee20

Browse files
committed
review feedback
1 parent fa9c7c2 commit fdfee20

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/FaviconService.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ await Parallel.ForEachAsync(bookmarks, options, async (bookmark, token) =>
133133
{
134134
// Another thread may have created it concurrently.
135135
}
136-
bookmark.FaviconPath = path;
137-
return;
136+
if (File.Exists(path))
137+
{
138+
bookmark.FaviconPath = path;
139+
return;
140+
}
141+
// If write failed and file still doesn't exist, fall through to web fallback.
138142
}
139143
}
140144

@@ -236,12 +240,16 @@ private static string GetCachePath(string url, string cacheDir)
236240
{
237241
// Another thread may have created it concurrently.
238242
}
239-
_context.API.LogDebug(nameof(FaviconService), $"Favicon for {urlString} cached successfully.");
240-
if (_failedFetches.TryRemove(urlString, out _))
243+
if (File.Exists(cachePath))
241244
{
242-
_ = SaveFailedFetchesAsync();
245+
_context.API.LogDebug(nameof(FaviconService), $"Favicon for {urlString} cached successfully.");
246+
if (_failedFetches.TryRemove(urlString, out _))
247+
{
248+
_ = SaveFailedFetchesAsync();
249+
}
250+
return cachePath;
243251
}
244-
return cachePath;
252+
// Do not treat as success; let finally record failure if needed.
245253
}
246254

247255
_context.API.LogDebug(nameof(FaviconService), $"No suitable favicon found for {urlString} after all tasks.");

0 commit comments

Comments
 (0)