diff --git a/lib/PathNormalizer.js b/lib/PathNormalizer.js new file mode 100644 index 00000000..843e1f97 --- /dev/null +++ b/lib/PathNormalizer.js @@ -0,0 +1,13 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PathNormalizer = void 0; +const path_1 = __importDefault(require("path")); +class PathNormalizer { + static normalizePath(pathString) { + return path_1.default.resolve(pathString).split(path_1.default.sep).join("/"); + } +} +exports.PathNormalizer = PathNormalizer; diff --git a/src/ArtifactGlobber.ts b/src/ArtifactGlobber.ts index 2f5887de..c8984ae9 100644 --- a/src/ArtifactGlobber.ts +++ b/src/ArtifactGlobber.ts @@ -3,6 +3,7 @@ import {Globber, FileGlobber} from "./Globber"; import {Artifact} from "./Artifact"; import untildify from "untildify"; import {ArtifactPathValidator} from "./ArtifactPathValidator"; +import {PathNormalizer} from "./PathNormalizer"; export interface ArtifactGlobber { globArtifactString(artifact: string, contentType: string, errorsFailBuild: boolean): Artifact[] @@ -19,6 +20,7 @@ export class FileArtifactGlobber implements ArtifactGlobber { const split = /[,\n]/ return artifact.split(split) .map(path => path.trimStart()) + .map(path => PathNormalizer.normalizePath(path)) .map(path => FileArtifactGlobber.expandPath(path)) .map(pattern => this.globPattern(pattern, errorsFailBuild)) .map((globResult) => FileArtifactGlobber.validatePattern(errorsFailBuild, globResult[1], globResult[0])) diff --git a/src/PathNormalizer.ts b/src/PathNormalizer.ts new file mode 100644 index 00000000..7a5876a1 --- /dev/null +++ b/src/PathNormalizer.ts @@ -0,0 +1,7 @@ +import path from "path"; + +export class PathNormalizer { + static normalizePath(pathString: string): string { + return pathString.split(path.sep).join("/") + } +} \ No newline at end of file