Skip to content

Commit

Permalink
address #348
Browse files Browse the repository at this point in the history
  • Loading branch information
TomTasche committed Oct 30, 2024
1 parent eae5539 commit 4ed7339
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
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 4ed7339

Please sign in to comment.