Fix WebTorrent client race condition and silence legacy avatar warning

- Added a null check for `this.client` in `js/webtorrent.js` after `await this.init()` to prevent `TypeError` when cleanup occurs during initialization.
- Updated `js/utils/profileMedia.js` to silently ignore the legacy `images/robot.png` path, preventing "Unsupported media URL" warnings.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-29 14:14:30 +00:00
1 parent bb097283c2
commit bf7988226d
2 files changed
+9

No files matched your search

+4
View File
@@ -46,6 +46,10 @@ export function sanitizeProfileMediaUrl(value) {
return trimmed;
}
if (trimmed === "images/robot.png") {
return "";
}
if (/^ipfs:\/\//i.test(trimmed)) {
return normalizeIpfsGatewayUrl(trimmed);
}
+5
View File
@@ -873,6 +873,11 @@ export class TorrentClient {
emit("torrent-stream-start", { magnet: magnetURI });
// 1) Make sure we have a WebTorrent client and a valid SW registration.
const initResult = await this.init();
if (!this.client) {
throw new Error("Client destroyed during initialization");
}
const serviceWorkerReady =
!!(initResult?.serviceWorkerReady && this.swRegistration);