Преглед на файлове

filter non-numeric characters before generating an tel:// url

cyberta преди 4 години
родител
ревизия
09d25c2635
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      deltachat-ios/Chat/ChatViewController.swift

+ 3 - 2
deltachat-ios/Chat/ChatViewController.swift

@@ -1302,10 +1302,11 @@ extension ChatViewController: BaseMessageCellDelegate {
         if handleUIMenu() || handleSelection(indexPath: indexPath) {
         if handleUIMenu() || handleSelection(indexPath: indexPath) {
             return
             return
         }
         }
-        if let phoneURL = URL(string: "tel://\(number)") {
+        let sanitizedNumber = number.filter("0123456789".contains)
+        if let phoneURL = URL(string: "tel://\(sanitizedNumber)") {
             UIApplication.shared.open(phoneURL, options: [:], completionHandler: nil)
             UIApplication.shared.open(phoneURL, options: [:], completionHandler: nil)
         }
         }
-        logger.debug("phone number tapped \(number)")
+        logger.debug("phone number tapped \(sanitizedNumber)")
     }
     }
 
 
     @objc func commandTapped(command: String, indexPath: IndexPath) {
     @objc func commandTapped(command: String, indexPath: IndexPath) {