encode channel names

This commit is contained in:
Thomas Zarebczan 2022-04-20 16:40:03 -04:00
parent 8144a9bb87
commit b832f56929
No known key found for this signature in database
GPG key ID: 767B41E1BB7346F2
2 changed files with 5 additions and 2 deletions

View file

@ -288,10 +288,11 @@ function PublishForm(props: Props) {
throw e; throw e;
} }
if (signedMessage) { if (signedMessage) {
const encodedChannelName = encodeURIComponent(channelName || '');
const newEndpointUrl = const newEndpointUrl =
`${NEW_LIVESTREAM_REPLAY_API}?channel_claim_id=${channelId}` + `${NEW_LIVESTREAM_REPLAY_API}?channel_claim_id=${channelId}` +
`&signature=${signedMessage.signature}&signature_ts=${signedMessage.signing_ts}&channel_name=${ `&signature=${signedMessage.signature}&signature_ts=${signedMessage.signing_ts}&channel_name=${
channelName || '' encodedChannelName || ''
}`; }`;
const responseFromNewApi = await fetch(newEndpointUrl); const responseFromNewApi = await fetch(newEndpointUrl);

View file

@ -183,8 +183,10 @@ export const killStream = async (channelId: string, channelName: string) => {
try { try {
const streamData = await getStreamData(channelId, channelName); const streamData = await getStreamData(channelId, channelName);
const encodedChannelName = encodeURIComponent(channelName);
const apiData = await fetch( const apiData = await fetch(
`${LIVESTREAM_KILL}channel_claim_id=${channelId}&channel_name=${channelName}&signature_ts=${streamData.t}&signature=${streamData.s}` `${LIVESTREAM_KILL}channel_claim_id=${channelId}&channel_name=${encodedChannelName}&signature_ts=${streamData.t}&signature=${streamData.s}`
); );
const data = (await apiData.json()).data; const data = (await apiData.json()).data;