Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions site/src/libs/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ function getExamplesAssetsRecursively(source: string, assets: string[] = []) {
}

function sanitizeAssetPath(assetPath: string) {
const matches = assetPath.match(/([^\/]+\/[^\/]+\.\w+)$/)
const matches = assetPath.match(/([^\/\\]+[\/\\][^\/\\]+\.\w+)$/)

if (!matches || !matches[1]) {
throw new Error(`Failed to get example asset path from path: '${assetPath}'.`)
}

return matches[1]
return matches[1].replaceAll('\\', '/')
}

function isAliasedAstroInstance(page: AstroInstance): page is AliasedAstroInstance {
Expand Down
3 changes: 2 additions & 1 deletion site/src/libs/path.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs'
import path from 'node:path'
import { getConfig } from './config'
import { fileURLToPath } from 'node:url';

// The docs directory path relative to the root of the project.
export const docsDirectory = getConfig().docsDir
Expand Down Expand Up @@ -32,7 +33,7 @@ export function validateVersionedDocsPaths(distUrl: URL) {

for (const docsPath of generatedVersionedDocsPaths) {
const sanitizedDocsPath = sanitizeVersionedDocsPathForValidation(docsPath)
const absoluteDocsPath = path.join(distUrl.pathname, 'docs', docs_version, sanitizedDocsPath)
const absoluteDocsPath = fileURLToPath(new URL(path.join( './docs', docs_version, sanitizedDocsPath), distUrl));

const docsPathExists = fs.existsSync(absoluteDocsPath)

Expand Down