浏览代码

Fix printing normal text as markup

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 年之前
父节点
当前提交
05ac776031
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      iOSClient/Main/NCFunctionCenter.swift

+ 7 - 2
iOSClient/Main/NCFunctionCenter.swift

@@ -306,8 +306,13 @@ import SVGKit
         }
 
         guard let text = String(data: data, encoding: .utf8) else { return }
-        let textWithoutNewlines = text.replacingOccurrences(of: "\n", with: "<br />")
-        let formatter = UIMarkupTextPrintFormatter(markupText: textWithoutNewlines)
+        let formatter: UIPrintFormatter
+        if metadata.classFile == "text/html" {
+            let textWithoutNewlines = text.replacingOccurrences(of: "\n", with: "<br />")
+            formatter = UIMarkupTextPrintFormatter(markupText: textWithoutNewlines)
+        } else {
+            formatter = UISimpleTextPrintFormatter(text: text)
+        }
         formatter.perPageContentInsets.top = 72
         formatter.perPageContentInsets.bottom = 72
         formatter.perPageContentInsets.left = 72