Skip to content

Fix(jsonrpc): Do not error on missign webxdc info #6866

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

Merged
merged 5 commits into from
May 28, 2025
Merged

Conversation

Septias
Copy link
Collaborator

@Septias Septias commented May 20, 2025

When an invalid webxdc is set as draft, json-rpc's get_draft fails, because get_webxdc_info which it calls, fails because the zip reader can not read a non-zip file. With this change, any error occurring in get_webxdc_info is ignored and the None-variant is returned instead. I also added a test, that setting invalid xdcs is draft is fine core-wise and checked that the input field stays responsive when a fake.xdc produced like in #6826 is added to draft

close #6826

@Septias Septias changed the base branch from main to link2xt/pgp-contacts May 20, 2025 17:00
@link2xt
Copy link
Collaborator

link2xt commented May 20, 2025

If it is a bugfix for the main branch, it's better to base it on main branch and not pgp-contacts branch.

@Septias
Copy link
Collaborator Author

Septias commented May 21, 2025

I thought at some point @Hocuri noted that it would reduce merge problems if we just keep this as temporary main branch. I'm not up to date about the current situation on core though.

@Hocuri
Copy link
Collaborator

Hocuri commented May 22, 2025

This was an idea of mine, but it's up to @link2xt to decide since he's the one who maintains the PGP-branch, and @link2xt said that he's fine with just maintaining it while we continue merging bug fixes into main. I guess features that interact with PGP-contacts should be implemented on top of PGP-contacts, but also here, if in doubt let's just ask @link2xt beforehand.

@link2xt
Copy link
Collaborator

link2xt commented May 22, 2025

I merge the main branch into pgp-contacts branch from time to time, it's not a problem. This way we can also release bugfixes before we merge pgp-contacts branch into main. I want to squash-merged PGP-branch eventually, so it should have only PGP-contacts related changes compared to main.

@link2xt link2xt force-pushed the link2xt/pgp-contacts branch 2 times, most recently from dff076c to 72614b0 Compare May 26, 2025 05:15
@Septias Septias changed the base branch from link2xt/pgp-contacts to main May 26, 2025 15:11
@Septias Septias requested review from Hocuri, iequidoo and link2xt May 26, 2025 15:12
@Septias Septias enabled auto-merge (squash) May 27, 2025 13:28
@@ -124,6 +124,23 @@ async fn test_send_invalid_webxdc() -> Result<()> {
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_set_draft_invalid_webxdc() -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test is not actually failing when I revert the fix, seems not to reproduce the bug

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The bug is deltachat-json-rpc specific. I tried to replicate the issue in core first and left the test as an artifact.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it realistic to reproduce the bug with a python test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Rather a jsonrpc test, but I think it's unnecessary for such a small thing

Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't matter whether it's a Typescript JsonRPC or a Python JsonRPC test (in deltachat-rpc-client/tests/test_something.py), both are testing mostly the same API.

BTW, to prevent confusion about which Python bindings are meant, at some point we should rename the deprecated CFFI Python bindings, which are currently in python/, to python-deprecated, and then rename deltachat-rpc-client to python-rpc-client (or similar).

Copy link
Collaborator

@Hocuri Hocuri left a comment

Choose a reason for hiding this comment

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

Assuming that you checked that the Typescript test fails without the fix, LGTM

@Septias Septias merged commit 81a6afd into main May 28, 2025
28 of 29 checks passed
@Septias Septias deleted the sk/invalid_xdc branch May 28, 2025 14:29
@link2xt
Copy link
Collaborator

link2xt commented May 28, 2025

Typescript test did not even pass npm run build at the time of merging: https://github.com/chatmail/core/actions/runs/15302218314/job/43045514130

@Septias
Copy link
Collaborator Author

Septias commented May 28, 2025

automerge mistake; will create a fix pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding an invalid .xdc to draft makes get_draft always fail
3 participants