Skip to content

Commit b786ac7

Browse files
committed
chore: use urlString for returning rtmp resource
1 parent 56f419e commit b786ac7

File tree

1 file changed

+2
-1
lines changed
  • packages/cloudfront-signer/src

1 file changed

+2
-1
lines changed

packages/cloudfront-signer/src/sign.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ function getResource(urlString: string): string {
259259
return urlString;
260260
case "rtmp:":
261261
const url = new URL(urlString);
262-
return url.pathname.replace(/^\//, "") + url.search + url.hash;
262+
const origin = `${protocol}//${url.hostname}`;
263+
return urlString.substring(origin.length).replace(/(?::\d+)?\//, "");
263264
default:
264265
throw new Error("Invalid URI scheme. Scheme must be one of http, https, or rtmp");
265266
}

0 commit comments

Comments
 (0)