Skip to content

Commit

Permalink
[React Native] Patch RCTFileReaderModule readAsDataURL to prevent…
Browse files Browse the repository at this point in the history
… crash when `type` is `nil` (#5475)
  • Loading branch information
haileyok authored Sep 24, 2024
1 parent ea43d20 commit 6338083
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions patches/react-native+0.74.1.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
diff --git a/node_modules/react-native/Libraries/Blob/RCTFileReaderModule.mm b/node_modules/react-native/Libraries/Blob/RCTFileReaderModule.mm
index caa5540..6027825 100644
--- a/node_modules/react-native/Libraries/Blob/RCTFileReaderModule.mm
+++ b/node_modules/react-native/Libraries/Blob/RCTFileReaderModule.mm
@@ -71,7 +71,7 @@ @implementation RCTFileReaderModule
[NSString stringWithFormat:@"Unable to resolve data for blob: %@", [RCTConvert NSString:blob[@"blobId"]]],
nil);
} else {
- NSString *type = [RCTConvert NSString:blob[@"type"]];
+ NSString *type = RCTNilIfNull([RCTConvert NSString:blob[@"type"]]);
NSString *text = [NSString stringWithFormat:@"data:%@;base64,%@",
type != nil && [type length] > 0 ? type : @"application/octet-stream",
[data base64EncodedStringWithOptions:0]];
diff --git a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
index b0d71dc..9974932 100644
index b0d71dc..41b9a0e 100644
--- a/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
+++ b/node_modules/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm
@@ -377,10 +377,6 @@ - (void)textInputDidBeginEditing
Expand Down Expand Up @@ -36,7 +49,7 @@ index e9b330f..1ecdf0a 100644
+
@end
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
index b09e653..4c32b31 100644
index b09e653..f93cb46 100644
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
@@ -198,9 +198,53 @@ - (void)refreshControlValueChanged
Expand Down

0 comments on commit 6338083

Please sign in to comment.