diff --git a/client/core/webtorrent.js b/client/core/webtorrent.js index 07d10911..10c0f255 100644 --- a/client/core/webtorrent.js +++ b/client/core/webtorrent.js @@ -218,7 +218,8 @@ export default class TorrentClient extends WebTorrent { for (const file of Object.values(map)) { const data = await file.arrayBuffer() if (targetFile !== this.currentFile) return - this.dispatch('file', { data: new Uint8Array(data) }, [data]) + // the renderer reads this as a binary string, same as embedded attachments send + this.dispatch('file', hex2bin(arr2hex(new Uint8Array(data)))) } } diff --git a/common/modules/subtitles.js b/common/modules/subtitles.js index fbb7f060..88eb365e 100644 --- a/common/modules/subtitles.js +++ b/common/modules/subtitles.js @@ -43,6 +43,8 @@ export default class Subtitles { this.handleFile = (detail) => { if (this.selected) { const uint8 = hex2arr(bin2hex(detail)) + // an empty font throw away. + if (!uint8.length) return console.warn('Discarded an empty font, subtitles may render with a fallback typeface.') this.fonts.push(uint8) this.renderer?.addFont(uint8) }