diff options
-rw-r--r-- | packages/astro/src/core/util.ts | 9 | ||||
-rw-r--r-- | packages/astro/test/underscore-in-folder-name.test.js | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 8c6e161b8..d3e7c8662 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -126,12 +126,11 @@ function isPublicRoute(file: URL, config: AstroConfig): boolean { // Normalize the file directory path by removing the pagesDir prefix if it exists, // otherwise remove the rootDir prefix. - const normalizedDir = fileDir.startsWith(pagesDir) ? fileDir.slice(pagesDir.length) : fileDir.slice(rootDir.length); + const normalizedDir = fileDir.startsWith(pagesDir) + ? fileDir.slice(pagesDir.length) + : fileDir.slice(rootDir.length); - const parts = normalizedDir - .replace(pagesDir.toString(), '') - .split('/') - .slice(1); + const parts = normalizedDir.replace(pagesDir.toString(), '').split('/').slice(1); for (const part of parts) { if (part.startsWith('_')) return false; diff --git a/packages/astro/test/underscore-in-folder-name.test.js b/packages/astro/test/underscore-in-folder-name.test.js index 2074c9d49..622ba977d 100644 --- a/packages/astro/test/underscore-in-folder-name.test.js +++ b/packages/astro/test/underscore-in-folder-name.test.js @@ -1,7 +1,7 @@ import assert from 'node:assert/strict'; import { before, describe, it } from 'node:test'; -import { loadFixture } from './test-utils.js'; import testAdapter from './test-adapter.js'; +import { loadFixture } from './test-utils.js'; describe('Projects with a underscore in the folder name', () => { let fixture; |