Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件夹是中文,导致生成侧边栏失败 #717

Closed
MeetInInc opened this issue Aug 9, 2018 · 2 comments
Closed

文件夹是中文,导致生成侧边栏失败 #717

MeetInInc opened this issue Aug 9, 2018 · 2 comments
Labels
contribution welcome Contributions welcome version: next Planned to do or already included in the next(1.0.0) version

Comments

@MeetInInc
Copy link
Contributor

Bug report

Version

v0.14.0

Steps to reproduce

snip20180809_7

snip20180809_6

下方是修复之后的 resolveMatchingConfig 方法

export function resolveMatchingConfig (route, config) {
  if (Array.isArray(config)) {
    return {
      base: '/',
      config: config
    }
  }
  for (const base in config) {
    const encodeBase = encodeURI(base)
    if (ensureEndingSlash(route.path).indexOf(encodeBase) === 0) {
      return {
        base,
        config: config[base]
      }
    }
  }
  return {}
}

route 中的 path 是经过编码的
config 中的 base 没有编码
所以匹配不上,返回了空数组,也就是侧边栏为空了
加了一个 encodeURI 编码的逻辑就正常显示侧边栏了

@ulivz
Copy link
Member

ulivz commented Aug 9, 2018

Thanks and contribution welcome!

@ulivz ulivz added the contribution welcome Contributions welcome label Aug 9, 2018
@smile921
Copy link

'/docs/wiki/blog.wiki/vim配置',
if the page file name has some Chinese ,then the side render will fail

image

@ulivz ulivz added the version: next Planned to do or already included in the next(1.0.0) version label Aug 20, 2018
@ulivz ulivz closed this as completed in 285b368 Mar 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Contributions welcome version: next Planned to do or already included in the next(1.0.0) version
Projects
None yet
Development

No branches or pull requests

3 participants