From 704e7cd7d9ebb46024ef13e8b964c0a92e6fe1c0 Mon Sep 17 00:00:00 2001 From: abalabahaha Date: Sun, 3 Dec 2017 12:37:03 -0800 Subject: [PATCH] Fix router generation for page names containing @/~ --- lib/app/components/nuxt.js | 2 +- lib/common/utils.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/app/components/nuxt.js b/lib/app/components/nuxt.js index 333762ac4e..380bf5f110 100644 --- a/lib/app/components/nuxt.js +++ b/lib/app/components/nuxt.js @@ -1,6 +1,6 @@ import Vue from 'vue' import NuxtChild from './nuxt-child' -import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.includes('~') || components.ErrorPage.includes('@')) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>' +import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.indexOf('~') === 0 || components.ErrorPage.indexOf('@') === 0) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>' import { compile } from '../utils' export default { diff --git a/lib/common/utils.js b/lib/common/utils.js index 71aba7a4a7..20587828df 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -118,7 +118,7 @@ export function r() { let args = Array.prototype.slice.apply(arguments) let lastArg = _.last(args) - if (lastArg.includes('@') || lastArg.includes('~')) { + if (lastArg.indexOf('@') === 0 || lastArg.indexOf('~') === 0) { return wp(lastArg) } @@ -133,7 +133,7 @@ export function relativeTo() { let path = r(...args) // Check if path is an alias - if (path.includes('@') || path.includes('~')) { + if (path.indexOf('@') === 0 || path.indexOf('~') === 0) { return path }