From efcb00199026a1eb7933bf5f63f4c8abf7a54142 Mon Sep 17 00:00:00 2001 From: Nicholas Lim <18374483+niclim@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:57:23 -0700 Subject: [PATCH] fix windows path case sensitivity (#2831) --- package.json | 2 +- projects/fastify-capture/package.json | 2 +- projects/json-pointer-helpers/package.json | 2 +- projects/openapi-io/package.json | 2 +- projects/openapi-utilities/package.json | 2 +- projects/optic/package.json | 2 +- projects/optic/src/utils/spec-loaders.ts | 10 ++++++---- projects/rulesets-base/package.json | 2 +- projects/standard-rulesets/package.json | 2 +- 9 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index f337b637aa..c304264f3e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "openapi-workspaces", "license": "MIT", "private": true, - "version": "0.54.12", + "version": "0.54.13", "workspaces": [ "projects/json-pointer-helpers", "projects/openapi-io", diff --git a/projects/fastify-capture/package.json b/projects/fastify-capture/package.json index 63540813cc..6ecf089dda 100644 --- a/projects/fastify-capture/package.json +++ b/projects/fastify-capture/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/fastify-capture", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/json-pointer-helpers/package.json b/projects/json-pointer-helpers/package.json index 4dc6c89fda..44f7ea963b 100644 --- a/projects/json-pointer-helpers/package.json +++ b/projects/json-pointer-helpers/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/json-pointer-helpers", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/openapi-io/package.json b/projects/openapi-io/package.json index a1de91522a..7938b9a7af 100644 --- a/projects/openapi-io/package.json +++ b/projects/openapi-io/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/openapi-io", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/openapi-utilities/package.json b/projects/openapi-utilities/package.json index f97c3d1913..cf911afb14 100644 --- a/projects/openapi-utilities/package.json +++ b/projects/openapi-utilities/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/openapi-utilities", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/optic/package.json b/projects/optic/package.json index b6cd6afa16..ddd0c4b1e3 100644 --- a/projects/optic/package.json +++ b/projects/optic/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/optic", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/optic/src/utils/spec-loaders.ts b/projects/optic/src/utils/spec-loaders.ts index bd055a2a7a..18569a3e22 100644 --- a/projects/optic/src/utils/spec-loaders.ts +++ b/projects/optic/src/utils/spec-loaders.ts @@ -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; @@ -118,10 +123,7 @@ export function parseOpticRef(raw?: string | null): SpecFromInput { apiId: maybeCloudMatch.groups.apiId, tag: maybeCloudMatch.groups.tag, }; - } else if ( - raw.includes(':') && - !(raw.startsWith('C:') || raw.startsWith('D:')) - ) { + } else if (raw.includes(':') && !isWindowsDrivePath(raw)) { const index = raw.indexOf(':'); const rev = raw.substring(0, index); const name = raw.substring(index + 1); diff --git a/projects/rulesets-base/package.json b/projects/rulesets-base/package.json index c1fa6e5e26..545a78ee7b 100644 --- a/projects/rulesets-base/package.json +++ b/projects/rulesets-base/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/rulesets-base", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [ diff --git a/projects/standard-rulesets/package.json b/projects/standard-rulesets/package.json index 57edf86ea1..3dc7eea44e 100644 --- a/projects/standard-rulesets/package.json +++ b/projects/standard-rulesets/package.json @@ -2,7 +2,7 @@ "name": "@useoptic/standard-rulesets", "license": "MIT", "packageManager": "yarn@4.1.1", - "version": "0.54.12", + "version": "0.54.13", "main": "build/index.js", "types": "build/index.d.ts", "files": [