Skip to content

Commit 4ae1bcd

Browse files
committed
fetchContent: fix URI concatenation
1 parent b2a014d commit 4ae1bcd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/lib/feeds.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ export async function getFeedPostsByUrl(
147147
);
148148
}
149149

150+
function concatURI(base: string, path: string): string {
151+
return `${base}/${path}`;
152+
}
153+
150154
/** Fetch content from remote.
151155
*
152156
* Platform must support [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to use this function.
@@ -167,10 +171,12 @@ export async function fetchContent(
167171
} = {},
168172
): Fork<NotFoundError, Response> {
169173
const url = new URL(
170-
`feeds/${encodeURIComponent(
171-
feedUrlBlake3Base64,
172-
)}/posts/${encodeURIComponent(postIdBlake3Base64)}/content`,
173-
client.endpointBase,
174+
concatURI(
175+
client.endpointBase,
176+
`feeds/${encodeURIComponent(
177+
feedUrlBlake3Base64,
178+
)}/posts/${encodeURIComponent(postIdBlake3Base64)}/content`,
179+
),
174180
);
175181
const contentType = opts.contentType || '*/*';
176182
const acceptLangs = opts.langs

0 commit comments

Comments
 (0)