Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message if restoring from JSON file #1056

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

vetleledaal
Copy link
Contributor

Current state

Older versions of Tachiyomi support backing up and restoring from JSON files. If a user tries to restore from such a backup they should be nudged in correct direction. Currently the error message is very cryptic and leads to a support burden:

kotlinx.serialization.protobuf.internal.ProtobufDecodingException: Unsupported start group or end group wire type: 3

Proposed change

Users are likely to expect old JSON backups to still be usable in Mihon, unless told directly. With the proposed change there is a de minimis maintenance/performance burden as it hooks into the existing gzip signature check. The new error message:

java.lang.Exception: JSON backup not supported

Limitations

If the user picks a JSON file that is not a backup file from Tachiyomi the error message will falsely imply that the file is a valid Tachiyomi JSON backup file. Accounting for this would be non-feasible, and an unlikely scenario.

[!] I do not have an actual JSON backup file from Tachiyomi at hand, I assume it looks like a regular JSON file.

Images

Image 1 Image 2
before after

@MajorTanya
Copy link
Contributor

MajorTanya commented Jul 26, 2024

They hadn't been usable in Tachiyomi for quite a while either afaik

Edit: Although considering this is just an error message, I don't think it'd be a problem to have it in Mihon.

@BrutuZ
Copy link

BrutuZ commented Jul 26, 2024

How do people even manage to select these, aren't JSON files filtered out of the file picker already? 🤔

@vetleledaal
Copy link
Contributor Author

They hadn't been usable in Tachiyomi for quite a while either afaik

Still, people do manage to run into these issues, and not everyone bothers asking for support.

aren't JSON files filtered out of the file picker already?

It shows every file type for me ¯\_(ツ)_/¯

@AntsyLich
Copy link
Member

How do people even manage to select these, aren't JSON files filtered out of the file picker already? 🤔

No file is filtered out

Copy link
Member

@AntsyLich AntsyLich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think you can also do a try catch on the decode function forProtobufDecodingEception and say the backup file is corrupted?

@BrutuZ
Copy link

BrutuZ commented Jul 27, 2024

No file is filtered out

Could / should they be?

@vetleledaal
Copy link
Contributor Author

I have changed it so it will throw a more generic error in all cases. Should the Full error: string and the java.io.IOException also be changed/removed?

Image 1, old JSON backup Image 2, invalid file
test_json test_other

@AntsyLich
Copy link
Member

I dedicate this PR merge to @ThaDaVos

@AntsyLich AntsyLich merged commit de8ef6d into mihonapp:main Jul 31, 2024
1 check passed
cuong-tran pushed a commit to komikku-app/komikku that referenced this pull request Aug 2, 2024
* Improve error message if restoring from JSON file

* Replace Exception with IOException

* Use more generic error message if protobuf fails

* fix lint

(cherry picked from commit de8ef6d)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants