Skip to content

Commit

Permalink
fix windows path case sensitivity (#2831)
Browse files Browse the repository at this point in the history
  • Loading branch information
niclim authored Apr 16, 2024
1 parent 4a0b4d7 commit efcb001
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion projects/fastify-capture/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/fastify-capture",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/json-pointer-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/json-pointer-helpers",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-io",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/openapi-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/openapi-utilities",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/optic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/optic",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
10 changes: 6 additions & 4 deletions 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 All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion projects/rulesets-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/rulesets-base",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion projects/standard-rulesets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@useoptic/standard-rulesets",
"license": "MIT",
"packageManager": "[email protected]",
"version": "0.54.12",
"version": "0.54.13",
"main": "build/index.js",
"types": "build/index.d.ts",
"files": [
Expand Down

0 comments on commit efcb001

Please sign in to comment.