fix: magnet handling issue caused by #1041 (#1056)

This commit is contained in:
Jagadam Dinesh Reddy 2023-08-21 14:50:31 +05:30 committed by GitHub
parent a5d2fce65a
commit 6432dd9416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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' })
}
}