From 4ed7339a9f2ce0ad3c3f4a93a030d6c354b5a55f Mon Sep 17 00:00:00 2001 From: Thomas Taschauer Date: Wed, 30 Oct 2024 17:15:15 +0100 Subject: [PATCH 1/2] address #348 --- .../tomtasche/reader/background/CoreWrapper.java | 16 ++++++++-------- .../tomtasche/reader/background/OdfLoader.java | 8 ++++++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java b/app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java index eeceebe9bc0c..bcecd270203a 100644 --- a/app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java +++ b/app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java @@ -107,20 +107,20 @@ public static class CoreResult { public String extension; } - public class CoreCouldNotOpenException extends RuntimeException {} + public static class CoreCouldNotOpenException extends RuntimeException {} - public class CoreEncryptedException extends RuntimeException {} + public static class CoreEncryptedException extends RuntimeException {} - public class CoreCouldNotTranslateException extends RuntimeException {} + public static class CoreCouldNotTranslateException extends RuntimeException {} - public class CoreUnexpectedFormatException extends RuntimeException {} + public static class CoreUnexpectedFormatException extends RuntimeException {} - public class CoreUnexpectedErrorCodeException extends RuntimeException {} + public static class CoreUnexpectedErrorCodeException extends RuntimeException {} - public class CoreUnknownErrorException extends RuntimeException {} + public static class CoreUnknownErrorException extends RuntimeException {} - public class CoreCouldNotEditException extends RuntimeException {} + public static class CoreCouldNotEditException extends RuntimeException {} - public class CoreCouldNotSaveException extends RuntimeException {} + public static class CoreCouldNotSaveException extends RuntimeException {} } diff --git a/app/src/main/java/at/tomtasche/reader/background/OdfLoader.java b/app/src/main/java/at/tomtasche/reader/background/OdfLoader.java index e3c931dd2a17..7746957ea3ba 100644 --- a/app/src/main/java/at/tomtasche/reader/background/OdfLoader.java +++ b/app/src/main/java/at/tomtasche/reader/background/OdfLoader.java @@ -81,8 +81,12 @@ private void translate(Options options, Result result) throws Exception { CoreWrapper.CoreResult coreResult = lastCore.parse(coreOptions); String coreExtension = coreResult.extension; - // "unnamed" refers to default of Meta::typeToString - if (coreExtension != null && !coreExtension.equals("unnamed")) { + if (coreResult.exception == null && "pdf".equals(coreExtension)) { + // some PDFs do not cause an error in the core + // https://github.com/opendocument-app/OpenDocument.droid/issues/348#issuecomment-2446888981 + throw new CoreWrapper.CoreCouldNotTranslateException(); + } else if (!"unnamed".equals(coreExtension)) { + // "unnamed" refers to default of Meta::typeToString options.fileExtension = coreExtension; String fileType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(coreExtension); From 7dc06e762b1636d71581d836529aabb798934e72 Mon Sep 17 00:00:00 2001 From: Thomas Taschauer Date: Wed, 30 Oct 2024 17:16:54 +0100 Subject: [PATCH 2/2] raise version --- app/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index cda3a53c72d0..1ffa85401520 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@