Skip to content

Commit aea2923

Browse files
committed
fix: detect owner/repo shorthand without relying on URL parsing
In happy-dom/browser environments, new URL('owner/repo') resolves against the base URL instead of throwing. Now checks for http(s):// prefix explicitly. Also excludes live E2E tests from prepublishOnly.
1 parent cabe393 commit aea2923

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@auths-dev/verify",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"description": "Drop-in <auths-verify> web component for decentralized commit verification",
55
"type": "module",
66
"main": "dist/auths-verify.mjs",

src/resolvers/detect.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import type { ForgeConfig, ForgeType } from './types';
99
* - forgeHint overrides auto-detection
1010
*/
1111
export function detectForge(repoUrl: string, forgeHint?: string): ForgeConfig | null {
12+
// Detect shorthand "owner/repo" — no protocol means not a real URL
13+
const isFullUrl = /^https?:\/\//.test(repoUrl);
14+
1215
let url: URL | null = null;
13-
try {
14-
url = new URL(repoUrl);
15-
} catch {
16-
// Not a full URL — try owner/repo shorthand
16+
if (isFullUrl) {
17+
try {
18+
url = new URL(repoUrl);
19+
} catch {
20+
return null;
21+
}
1722
}
1823

1924
let owner: string;

vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default defineConfig({
55
test: {
66
environment: 'happy-dom',
77
include: ['tests/**/*.test.ts'],
8+
exclude: ['tests/e2e/**'],
89
globals: true,
910
},
1011
resolve: {

0 commit comments

Comments
 (0)