Skip to content

Commit

Permalink
Content safety (#5486)
Browse files Browse the repository at this point in the history
* add content safety check to avoid potential crashes

* Fixes iOS YouTube video playback
  • Loading branch information
enahum authored Jun 25, 2021
1 parent f7071c2 commit 47d081b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const EmbeddedBindings = ({embeds, postId, theme}: Props) => {
content.push(
<EmbeddedBinding
embed={embed}
key={'att_' + i.toString()}
key={'binding_' + i.toString()}
postId={postId}
theme={theme}
/>,
Expand Down
36 changes: 21 additions & 15 deletions app/components/post_list/post/body/content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,28 @@ const Content = ({isReplyPost, post, theme}: ContentProps) => {
/>
);
case contentType.message_attachment:
return (
<MessageAttachments
attachments={post.props.attachments}
metadata={post.metadata}
postId={post.id}
theme={theme}
/>
);
if (post.props.attachments?.length) {
return (
<MessageAttachments
attachments={post.props.attachments}
metadata={post.metadata}
postId={post.id}
theme={theme}
/>
);
}
break;
case contentType.app_bindings:
return (
<EmbeddedBindings
embeds={post.props.app_bindings}
postId={post.id}
theme={theme}
/>
);
if (post.props.app_bindings?.length) {
return (
<EmbeddedBindings
embeds={post.props.app_bindings}
postId={post.id}
theme={theme}
/>
);
}
break;
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ target 'Mattermost' do
pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly"

pod 'XCDYouTubeKit', '2.8.3'
pod 'XCDYouTubeKit', :git => 'https://github.com/hinge-agency/XCDYouTubeKit.git', :branch => 'fix/issue-534-XCDYouTubeVideoErrorDomain-error-code-3'
pod 'Swime', '3.0.6'

# Enables Flipper.
Expand Down
17 changes: 12 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ PODS:
- Sentry/Core (= 7.0.0)
- Sentry/Core (7.0.0)
- Swime (3.0.6)
- XCDYouTubeKit (2.8.3)
- XCDYouTubeKit (2.15.2)
- Yoga (1.14.0)
- YoutubePlayer-in-WKWebView (0.3.5)

Expand Down Expand Up @@ -512,7 +512,7 @@ DEPENDENCIES:
- RNSVG (from `../node_modules/react-native-svg`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- Swime (= 3.0.6)
- XCDYouTubeKit (= 2.8.3)
- XCDYouTubeKit (from `https://github.com/hinge-agency/XCDYouTubeKit.git`, branch `fix/issue-534-XCDYouTubeVideoErrorDomain-error-code-3`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand All @@ -526,7 +526,6 @@ SPEC REPOS:
- SDWebImageWebPCoder
- Sentry
- Swime
- XCDYouTubeKit
- YoutubePlayer-in-WKWebView

EXTERNAL SOURCES:
Expand Down Expand Up @@ -678,9 +677,17 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-svg"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
XCDYouTubeKit:
:branch: fix/issue-534-XCDYouTubeVideoErrorDomain-error-code-3
:git: https://github.com/hinge-agency/XCDYouTubeKit.git
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

CHECKOUT OPTIONS:
XCDYouTubeKit:
:commit: 38170db3934e575ad4bfb782dedc544f304b482f
:git: https://github.com/hinge-agency/XCDYouTubeKit.git

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
Expand Down Expand Up @@ -765,10 +772,10 @@ SPEC CHECKSUMS:
SDWebImageWebPCoder: d0dac55073088d24b2ac1b191a71a8f8d0adac21
Sentry: 89d26e036063b9cb9caa59b6951dd2f8277aa13b
Swime: d7b2c277503b6cea317774aedc2dce05613f8b0b
XCDYouTubeKit: 46df93c4dc4d48763ad720d997704384635c4335
XCDYouTubeKit: b120aced3d8638ffb570c5450cddb5a1dac448c7
Yoga: 575c581c63e0d35c9a83f4b46d01d63abc1100ac
YoutubePlayer-in-WKWebView: cfbf46da51d7370662a695a8f351e5fa1d3e1008

PODFILE CHECKSUM: a4402d26aaec4ef7e58bd8304848d89c876d285a
PODFILE CHECKSUM: c3bbb0fd2d81abb15a1f699210f18b2577ec458f

COCOAPODS: 1.10.1

0 comments on commit 47d081b

Please sign in to comment.