Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/recoup/getArtistSocials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { logger } from "@trigger.dev/sdk/v3";
import { z } from "zod";
import { NEW_API_BASE_URL, RECOUP_API_KEY } from "../consts";

const artistSocialsResponseSchema = z.object({
status: z.literal("success"),
Expand Down Expand Up @@ -31,8 +32,6 @@ export type ArtistSocialProfile = z.infer<
typeof artistSocialsResponseSchema
>["socials"][number];

const ARTIST_SOCIALS_API_URL = "https://api.recoupable.com/api/artist/socials";

export async function getArtistSocials(
artistAccountId: string
): Promise<ArtistSocialProfile[] | undefined> {
Expand All @@ -41,14 +40,19 @@ export async function getArtistSocials(
return undefined;
}

if (!RECOUP_API_KEY) {
logger.error("RECOUP_API_KEY not configured");
return undefined;
}

try {
const url = new URL(ARTIST_SOCIALS_API_URL);
url.searchParams.set("artist_account_id", artistAccountId);
const url = `${NEW_API_BASE_URL}/api/artists/${artistAccountId}/socials`;
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Wrap artistAccountId in encodeURIComponent() to safely embed it as a path segment. The previous query-param approach auto-encoded the value; the new template literal does not, so any ID containing /, ?, or # would break the URL.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/recoup/getArtistSocials.ts, line 49:

<comment>Wrap `artistAccountId` in `encodeURIComponent()` to safely embed it as a path segment. The previous query-param approach auto-encoded the value; the new template literal does not, so any ID containing `/`, `?`, or `#` would break the URL.</comment>

<file context>
@@ -41,14 +40,19 @@ export async function getArtistSocials(
   try {
-    const url = new URL(ARTIST_SOCIALS_API_URL);
-    url.searchParams.set("artist_account_id", artistAccountId);
+    const url = `${NEW_API_BASE_URL}/api/artists/${artistAccountId}/socials`;
 
-    const response = await fetch(url.toString(), {
</file context>
Suggested change
const url = `${NEW_API_BASE_URL}/api/artists/${artistAccountId}/socials`;
const url = `${NEW_API_BASE_URL}/api/artists/${encodeURIComponent(artistAccountId)}/socials`;
Fix with Cubic


const response = await fetch(url.toString(), {
const response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
"x-api-key": RECOUP_API_KEY,
},
});

Expand Down
Loading