fix(generator): avoid generating route with extension

This commit is contained in:
Sébastien Chopin 2020-05-08 16:27:15 +02:00
parent e87bad4cce
commit 80396cbf41

View File

@ -277,7 +277,7 @@ export default class Generator {
parse(html).querySelectorAll('a').map((el) => { parse(html).querySelectorAll('a').map((el) => {
const href = (el.getAttribute('href') || '').split('?')[0].split('#')[0].trim() const href = (el.getAttribute('href') || '').split('?')[0].split('#')[0].trim()
if (href.startsWith('/') && this.shouldGenerateRoute(href) && !this.generatedRoutes.has(href)) { if (href.startsWith('/') && !path.extname(href) && this.shouldGenerateRoute(href) && !this.generatedRoutes.has(href)) {
this.generatedRoutes.add(href) // add the route to the tracked list this.generatedRoutes.add(href) // add the route to the tracked list
this.routes.push({ route: href }) this.routes.push({ route: href })
} }