diff --git a/src/protocolHandler.ts b/src/protocolHandler.ts index 2d53e3f..e58af44 100644 --- a/src/protocolHandler.ts +++ b/src/protocolHandler.ts @@ -7,8 +7,10 @@ function registerProtocolHandler() { return; } + const baseUrl = location.origin + location.pathname; + try { - navigator.registerProtocolHandler('magnet', location.origin + '#download=%s', document.title); + navigator.registerProtocolHandler('magnet', baseUrl + '#download=%s', document.title); } catch (e) { log('Register protocol handler failed.', e); }