Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(live-streaming) fix handling bogus URLs

Saúl Ibarra Corretgéfa0b06b85989
diff --git a/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts b/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
index 727a1f27a8..392a82ec42 100644
--- a/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
+++ b/react/features/recording/components/LiveStream/AbstractStreamKeyForm.ts
@@ -21,11 +21,11 @@ export type LiveStreaming = {
};
export type LiveStreamingProps = {
- dataPrivacyURL: string;
+ dataPrivacyURL?: string;
enabled: boolean;
- helpURL: string;
+ helpURL?: string;
streamLinkRegexp: RegExp;
- termsURL: string;
+ termsURL?: string;
};
/**
diff --git a/react/features/recording/components/LiveStream/functions.ts b/react/features/recording/components/LiveStream/functions.ts
index d3ecaeaca4..a382bc439e 100644
--- a/react/features/recording/components/LiveStream/functions.ts
+++ b/react/features/recording/components/LiveStream/functions.ts
@@ -1,4 +1,5 @@
import { IReduxState } from '../../../app/types';
+import { sanitizeUrl } from '../../../base/util/uri';
import {
FOUR_GROUPS_DASH_SEPARATED,
@@ -15,15 +16,13 @@ import {
*/
export function getLiveStreaming(state: IReduxState) {
const { liveStreaming = {} } = state['features/base/config'];
-
- const regexp = liveStreaming.validatorRegExpString
- && new RegExp(liveStreaming.validatorRegExpString);
+ const regexp = liveStreaming.validatorRegExpString && new RegExp(liveStreaming.validatorRegExpString);
return {
enabled: Boolean(liveStreaming.enabled),
- helpURL: liveStreaming.helpLink || JITSI_LIVE_STREAMING_HELP_LINK,
- termsURL: liveStreaming.termsLink || YOUTUBE_TERMS_URL,
- dataPrivacyURL: liveStreaming.dataPrivacyLink || GOOGLE_PRIVACY_POLICY,
+ helpURL: sanitizeUrl(liveStreaming.helpLink || JITSI_LIVE_STREAMING_HELP_LINK)?.toString(),
+ termsURL: sanitizeUrl(liveStreaming.termsLink || YOUTUBE_TERMS_URL)?.toString(),
+ dataPrivacyURL: sanitizeUrl(liveStreaming.dataPrivacyLink || GOOGLE_PRIVACY_POLICY)?.toString(),
streamLinkRegexp: regexp || FOUR_GROUPS_DASH_SEPARATED
};
}
diff --git a/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx b/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
index f1a9c01c52..4124e09208 100644
--- a/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
+++ b/react/features/recording/components/LiveStream/native/StreamKeyForm.tsx
@@ -107,7 +107,11 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
* @returns {void}
*/
_onOpenGooglePrivacyPolicy() {
- Linking.openURL(this.props._liveStreaming.dataPrivacyURL);
+ const url = this.props._liveStreaming.dataPrivacyURL;
+
+ if (typeof url === 'string') {
+ Linking.openURL(url);
+ }
}
/**
@@ -118,10 +122,10 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
* @returns {void}
*/
_onOpenHelp() {
- const helpURL = this.props._liveStreaming.helpURL;
+ const url = this.props._liveStreaming.helpURL;
- if (typeof helpURL === 'string') {
- Linking.openURL(helpURL);
+ if (typeof url === 'string') {
+ Linking.openURL(url);
}
}
@@ -132,7 +136,11 @@ class StreamKeyForm extends AbstractStreamKeyForm<IProps> {
* @returns {void}
*/
_onOpenYoutubeTerms() {
- Linking.openURL(this.props._liveStreaming.termsURL);
+ const url = this.props._liveStreaming.termsURL;
+
+ if (typeof url === 'string') {
+ Linking.openURL(url);
+ }
}
}