mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 10:30:37 +09:00
refactor: rename URL validators to looksLikeRepoUrl
This commit is contained in:
parent
6a7830b07e
commit
9d89d74d70
5 changed files with 16 additions and 16 deletions
|
|
@ -984,7 +984,7 @@ async function readUrlSkillImports(
|
|||
): Promise<{ skills: ImportedSkill[]; warnings: string[] }> {
|
||||
const url = sourceUrl.trim();
|
||||
const warnings: string[] = [];
|
||||
const isGitHubRepoUrl = (() => { try {
|
||||
const looksLikeRepoUrl = (() => { try {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.protocol !== "https:") return false;
|
||||
const h = parsed.hostname.toLowerCase();
|
||||
|
|
@ -992,7 +992,7 @@ async function readUrlSkillImports(
|
|||
const segments = parsed.pathname.split("/").filter(Boolean);
|
||||
return segments.length >= 2 && !parsed.pathname.endsWith(".md");
|
||||
} catch { return false; } })();
|
||||
if (isGitHubRepoUrl) {
|
||||
if (looksLikeRepoUrl) {
|
||||
const parsed = parseGitHubSourceUrl(url);
|
||||
const apiBase = gitHubApiBase(parsed.hostname);
|
||||
const { pinnedRef, trackingRef } = await resolveGitHubPinnedRef(parsed);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue