Skip to content

Commit

Permalink
fix windows path case sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim committed Apr 12, 2024
1 parent 697d893 commit 2872511
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion projects/optic/src/utils/spec-loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ type SpecFromInput =
url: string;
};

function isWindowsDrivePath(raw: string) {
// matches windows drive paths (C:\... or d:\...)
return /^[a-zA-Z]:\\/.test(raw);
}

export function parseOpticRef(raw?: string | null): SpecFromInput {
raw = raw ?? 'null:';
let isUrl = false;
Expand Down Expand Up @@ -120,7 +125,7 @@ export function parseOpticRef(raw?: string | null): SpecFromInput {
};
} else if (
raw.includes(':') &&
!(raw.startsWith('C:') || raw.startsWith('D:'))
!isWindowsDrivePath(raw)
) {
const index = raw.indexOf(':');
const rev = raw.substring(0, index);
Expand Down

0 comments on commit 2872511

Please sign in to comment.