feat(setting): 网页快开支持普通网站#505
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new 'Webpage' type to the Web Search feature, allowing users to map specific keywords directly to URLs in addition to using search engine templates. Key changes include UI updates to the settings and editor components, backend support for direct URL opening via Electron's shell API, and a data migration to update legacy configurations to the new typed format. Additionally, the favicon fetching logic was improved with better error handling and a fix for potential decoding issues. Review feedback highlighted a potential issue with character corruption when converting stream chunks to strings in the favicon fetcher, suggesting a more robust decoding approach.
| @@ -313,38 +424,18 @@ class WebSearchAPI { | |||
| data += chunk.toString() | |||
There was a problem hiding this comment.
Using chunk.toString() on a stream of data can lead to corrupted characters if a multi-byte character (like UTF-8) is split across chunk boundaries. While likely safe for parsing ASCII-based HTML tags within the first 100KB, it is more robust to use a StringDecoder or collect all chunks before decoding.
| data += chunk.toString() | |
| data += chunk.toString('utf8') |
变更内容
动机
支持普通网站的快速打开
截图
相关 Issue