Skip to content

Commit

Permalink
fix(theme-default): allow non-url-encoded filename in theme config (c…
Browse files Browse the repository at this point in the history
…lose #884)
  • Loading branch information
meteorlxy committed May 12, 2022
1 parent 34028ff commit dd1d240
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -15,7 +15,10 @@ declare module 'vue-router' {
* - Output: { text: 'Home', link: '/' }
*/
export const useNavLink = (item: string): NavLink => {
const resolved = useResolveRouteWithRedirect(item)
// the route path of vue-router is url-encoded, and we expect users are using
// non-url-encoded string in theme config, so we need to url-encode it first to
// resolve the route correctly
const resolved = useResolveRouteWithRedirect(encodeURI(item))
return {
text: resolved.meta.title || item,
link: resolved.name === '404' ? item : resolved.fullPath,
Expand Down

0 comments on commit dd1d240

Please sign in to comment.