Skip to content

Commit c39b5ef

Browse files
committed
Refactor actorOwnerDNSFriendly to handle special characters
1 parent 46ef186 commit c39b5ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/mcp/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ export function getActorStandbyURL(actorID: string, standbyBaseUrl = 'apify.acto
7878
throw new Error(`Invalid actor ID: ${actorID}`);
7979
}
8080

81-
const actorOwnerDNSFriendly = actorOwner.replace('.', '-');
81+
// TODO: get from API
82+
const actorOwnerDNSFriendly = actorOwner
83+
.toLowerCase()
84+
.replace(/[^a-z0-9-]/g, '-') // only alphanumeric chars and hyphens allowed
85+
.replace(/-+/g, '-'); // replace multiple hyphens with one
8286
const prefix = actorOwner === APIFY_USERNAME ? '' : `${actorOwnerDNSFriendly}--`;
8387

8488
return `https://${prefix}${actorName}.${standbyBaseUrl}`;

0 commit comments

Comments
 (0)