فهرست منبع

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) {
             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)
         }
-        logger.debug("phone number tapped \(number)")
+        logger.debug("phone number tapped \(sanitizedNumber)")
     }
 
     @objc func commandTapped(command: String, indexPath: IndexPath) {