From 758553f20a01618719e8181d21f4bf5c8b4c8ced Mon Sep 17 00:00:00 2001 From: Akamaru Date: Thu, 18 Sep 2025 16:41:26 +0200 Subject: [PATCH] Fix Stack Overflow in torrent-to-transmission.user.js --- torrent-to-transmission.user.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/torrent-to-transmission.user.js b/torrent-to-transmission.user.js index e69078e..429d619 100644 --- a/torrent-to-transmission.user.js +++ b/torrent-to-transmission.user.js @@ -19,12 +19,12 @@ async function getConfig() { let config = await GM_getValue('transmissionConfig'); if (config) return JSON.parse(config); - return await askForConfig(); + return await askForConfigSimple(); } async function setConfig(config) { await GM_setValue('transmissionConfig', JSON.stringify(config)); } - async function askForConfig() { + async function askForConfigSimple() { let ipport = prompt('Transmission IP und Port (z.B. 192.168.1.100:9091):'); if (!ipport) return null; let user = prompt('Benutzername (leer lassen, falls nicht benötigt):'); @@ -656,7 +656,12 @@ responseType: 'arraybuffer', onload: function(response) { const arrayBuffer = response.response; - const base64 = btoa(String.fromCharCode.apply(null, new Uint8Array(arrayBuffer))); + const bytes = new Uint8Array(arrayBuffer); + let binary = ''; + for (let i = 0; i < bytes.byteLength; i++) { + binary += String.fromCharCode(bytes[i]); + } + const base64 = btoa(binary); const fileList = parseTorrentFileList(arrayBuffer); showPathDialog(function(dir, selectedFiles) { // selectedFiles: Array von bools, true = gewünscht