Skip to content

Commit

Permalink
Merge pull request #377 from opendocument-app/address-issue-348
Browse files Browse the repository at this point in the history
address #348
  • Loading branch information
TomTasche authored Oct 30, 2024
2 parents 8e9c8a2 + 7dc06e7 commit 2e5b2ce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto"
android:versionCode="185"
android:versionName="3.31"
android:versionCode="186"
android:versionName="3.32"
tools:ignore="GoogleAppIndexingWarning">

<uses-permission android:name="android.permission.INTERNET" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2e5b2ce

Please sign in to comment.