From 6432dd94168e37b8af2cd66241234cdec8c7738d Mon Sep 17 00:00:00 2001 From: Jagadam Dinesh Reddy Date: Mon, 21 Aug 2023 14:50:31 +0530 Subject: [PATCH] fix: magnet handling issue caused by #1041 (#1056) --- src/views/MagnetHandler.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/views/MagnetHandler.vue b/src/views/MagnetHandler.vue index ff362721..b85b955f 100644 --- a/src/views/MagnetHandler.vue +++ b/src/views/MagnetHandler.vue @@ -7,9 +7,19 @@ import { General } from '@/mixins' export default { name: 'MagnetHandler', mixins: [General], + methods: { + decodeMagnet(url) { + if (url.startsWith('magnet:?')) { + return url + } else { + return this.decodeMagnet(decodeURIComponent(url)) + } + } + }, created() { const regex = new RegExp('^\/download\=(.+?)(?:\/(?=$))?$', 'is') - this.createModal('AddModal', { initialMagnet: regex.exec(this.$route.fullPath)[1] }) + let magnetLink = this.decodeMagnet(regex.exec(this.$route.fullPath)[1]) + this.createModal('AddModal', { initialMagnet: magnetLink }) this.$router.push({ name: 'dashboard' }) } }