Эх сурвалжийг харах

fix PDF password special char

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 жил өмнө
parent
commit
eeb39ef1be

+ 9 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -490,7 +490,15 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
 
             let pdfData = NSMutableData()
 
-            if password.count > 0 {
+            if !password.isEmpty {
+                for char in password.unicodeScalars {
+                    if !char.isASCII {
+                        NCActivityIndicator.shared.stop()
+                        let error = NKError(errorCode: NCGlobal.shared.errorForbidden, errorDescription: "_password_ascii_")
+                        NCContentPresenter.shared.showError(error: error)
+                        return
+                    }
+                }
                 let info: [AnyHashable: Any] = [kCGPDFContextUserPassword as String: password, kCGPDFContextOwnerPassword as String: password]
                 UIGraphicsBeginPDFContextToData(pdfData, CGRect.zero, info)
             } else {

+ 1 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -908,6 +908,7 @@
 "_status_e2ee_not_setup_"   = "The end-to-end encryption is not yet configured on the server";
 "_change_upload_filename_"  = "Do you want to save the file with a different name ?";
 "_save_file_as_"            = "Save file as %@";
+"_password_ascii_"          = "The password cannot contain special characters";
 
 // Video
 "_select_trace_"            = "Select the trace";