File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -973,11 +973,20 @@ -(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAct
973973}
974974
975975- (void )downloadBase64File : (NSString *)base64String {
976+ // Infer file extension from the data: URL before doing any heavy work.
977+ // For generic application/octet-stream payloads we suppress the download
978+ // entirely (no "Do you want to download File.bin?" alert), since these
979+ // are typically iframe-driven noise rather than user‑initiated downloads.
980+ NSString *fileExtension = [self fileExtensionFromBase64String: base64String];
981+ if ([[fileExtension lowercaseString ] isEqualToString: @" bin" ]) {
982+ NSLog (@" RNCWebViewImpl: Ignoring generic binary download (File.bin) from data: URL" );
983+ return ;
984+ }
985+
976986 NSArray *components = [base64String componentsSeparatedByString: @" ," ];
977987 NSString *base64ContentPart = components.lastObject ;
978988
979989 NSData *fileData = [[NSData alloc ] initWithBase64EncodedString: base64ContentPart options: NSDataBase64DecodingIgnoreUnknownCharacters ];
980- NSString *fileExtension = [self fileExtensionFromBase64String: base64String];
981990 [self showDownloadAlert: fileExtension invokeDownload: ^{
982991 NSString *tempFilePath = [NSTemporaryDirectory () stringByAppendingPathComponent: [NSString stringWithFormat: @" File.%@ " , fileExtension]];
983992 [fileData writeToFile: tempFilePath atomically: YES ];
You can’t perform that action at this time.
0 commit comments