From e755581d181339af2f9490ce440aab5ee00abbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Schr=C3=B6ter?= Date: Fri, 2 Sep 2022 15:37:14 +0200 Subject: [PATCH] fix timestamp in share links (#1371) --- src/components/ShareModal.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/ShareModal.vue b/src/components/ShareModal.vue index 8ab2422f..92a98ae9 100644 --- a/src/components/ShareModal.vue +++ b/src/components/ShareModal.vue @@ -69,11 +69,12 @@ export default { }, computed: { generatedLink() { - var href = this.pipedLink + var baseUrl = this.pipedLink ? window.location.origin + "/watch?v=" + this.videoId : "https://youtu.be/" + this.videoId; - if (this.withTimeCode && this.timeStamp > 0) href += "?t=" + this.timeStamp; - return href; + var url = new URL(baseUrl); + if (this.withTimeCode && this.timeStamp > 0) url.searchParams.append("t", this.timeStamp); + return url.href; }, }, };