From e2ff62303c48846562b923abf3d3b147863a0334 Mon Sep 17 00:00:00 2001 From: Avris Date: Mon, 3 Aug 2020 14:54:43 +0200 Subject: [PATCH] =?UTF-8?q?#32=20fix=20social=20media=20ucinaj=C4=85=20gwi?= =?UTF-8?q?azdk=C4=99=20z=20`/on*`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/_.vue | 4 ++-- pages/index.vue | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pages/_.vue b/pages/_.vue index 272c2303..ecdaaf81 100644 --- a/pages/_.vue +++ b/pages/_.vue @@ -77,7 +77,7 @@ templates: templates, getTemplate: getTemplate, - selectedTemplate: buildTemplate(templates, this.$route.path.substr(1)), + selectedTemplate: buildTemplate(templates, this.$route.path.substr(1).replace(/\/$/, '')), counter: 0, } @@ -93,7 +93,7 @@ } const title = 'Moje zaimki to: ' + this.selectedTemplate.name(); - const banner = `${process.env.baseUrl}/banner${this.$route.path}.png`; + const banner = `${process.env.baseUrl}/banner${this.$route.path.replace(/\/$/, '')}.png`; return { title: title, diff --git a/pages/index.vue b/pages/index.vue index c6578da1..2f6c0e85 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -16,7 +16,7 @@ Wybierz sposród najpopularniejszych:

- + {{template.name()}} @@ -247,14 +247,14 @@ if (!this.selectedTemplate.pronoun()) { return null; } - return process.env.baseUrl + '/' + (this.usedBaseEquals ? this.usedBase : this.longLink); + return this.addSlash(process.env.baseUrl + '/' + (this.usedBaseEquals ? this.usedBase : this.longLink)); }, linkMultiple() { if (!this.multiple.length) { return null; } - return process.env.baseUrl + '/' + this.multiple.join('&'); + return this.addSlash(process.env.baseUrl + '/' + this.multiple.join('&')); }, sources() { return getSources(this.selectedTemplate); @@ -268,6 +268,9 @@ } else { this.multiple.push(name); } + }, + addSlash(link) { + return link + (link.substr(link.length - 1) === '*' ? '/' : ''); } }, }