From 4f2da9acf692db4d3605c170a26831cd3c300102 Mon Sep 17 00:00:00 2001 From: Josh Wooding <12938082+joshwooding@users.noreply.github.com> Date: Mon, 24 Oct 2022 01:01:21 +0100 Subject: [PATCH] Fix addon URLs on Windows --- code/lib/builder-manager/package.json | 1 + code/lib/builder-manager/src/utils/files.ts | 3 ++- code/yarn.lock | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/lib/builder-manager/package.json b/code/lib/builder-manager/package.json index 123a0b2f615c..19f439241c83 100644 --- a/code/lib/builder-manager/package.json +++ b/code/lib/builder-manager/package.json @@ -54,6 +54,7 @@ "express": "^4.17.1", "fs-extra": "^9.0.1", "process": "^0.11.10", + "slash": "^3.0.0", "util": "^0.12.4" }, "devDependencies": { diff --git a/code/lib/builder-manager/src/utils/files.ts b/code/lib/builder-manager/src/utils/files.ts index 8c1672608b1e..976a87621843 100644 --- a/code/lib/builder-manager/src/utils/files.ts +++ b/code/lib/builder-manager/src/utils/files.ts @@ -1,6 +1,7 @@ import { OutputFile } from 'esbuild'; import fs from 'fs-extra'; import { join } from 'path'; +import slash from 'slash'; import { Compilation } from '../types'; export async function readOrderedFiles( @@ -26,6 +27,6 @@ export async function readOrderedFiles( export function sanitizePath(file: OutputFile, addonsDir: string) { const filePath = file.path.replace(addonsDir, ''); const location = join(addonsDir, filePath); - const url = `./sb-addons${filePath.split('/').map(encodeURIComponent).join('/')}`; + const url = `./sb-addons${slash(filePath).split('/').map(encodeURIComponent).join('/')}`; return { location, url }; } diff --git a/code/yarn.lock b/code/yarn.lock index 517c6f5b2ade..0d6dcbd789d9 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -7061,6 +7061,7 @@ __metadata: express: ^4.17.1 fs-extra: ^9.0.1 process: ^0.11.10 + slash: ^3.0.0 typescript: ~4.6.3 util: ^0.12.4 languageName: unknown