nextcloud / nextcloud/mail

mail:account:export-threads does not export all database IDs

Open
#8,540 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. to triage bug
Dominant language
JavaScript
Stars
1k
Forks
348
Avg merge
12h 28m
Merged PRs (30d)
91

Description

Steps to reproduce
  1. get account-id via /occ mail:account:exports
  2. generate output in json format via /occ mail:account:export-threads
  3. get databaseId for every mail thread for the given account-id
Expected behavior

export in json format should show every databaseId for every e-mail in the account

Actual behavior

in my example, i have account with 28 e-mails, but only get 6 database IDs during the export. every mail does have its own database ID as shown in the url when i try to export the e-mail via the webinterface.

Example output:

user@host:~$ sudo -u webserver-user php <pathToOcc>/occ mail:account:export-threads -vvv -r <accountId>
[
    {
        "subject": "Re: a3efe45b670837a4704335656f5b8b3d@redacted",
        "id": "2415058a142305f999db4bc99a3940aa@redacted",
        "references": [
            "6c235513417464f5d65f3914add2b234@redacted",
            "6c235513417464f5d65f3914add2b234@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "6c235513417464f5d65f3914add2b234@redacted"
    },
    {
        "subject": "9ca2ed7be6578a0c4fa2fd057bb4a141@redacted",
        "id": "0c64684d7dab73da21dbacd98e49a421@redacted",
        "references": [
            "fca48ccf310a474900d362b7879e9096@redacted",
            "4a6ae17d284ef7cabe4d2a9771befb83@redacted",
            "fc0ed918d838cf01e9bbc41f178e48bb@redacted",
            "fc0ed918d838cf01e9bbc41f178e48bb@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "fc0ed918d838cf01e9bbc41f178e48bb@redacted"
    },
    {
        "subject": "Re: a3efe45b670837a4704335656f5b8b3d@redacted",
        "id": "2415058a142305f999db4bc99a3940aa@redacted",
        "references": [
            "6c235513417464f5d65f3914add2b234@redacted",
            "6c235513417464f5d65f3914add2b234@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "6c235513417464f5d65f3914add2b234@redacted"
    },
    {
        "subject": "465ed63965f16b02c0bd7ab3444f12fb@redacted",
        "id": "a6c14dcb63b36adcc582da719a2f48ec@redacted",
        "references": [
            "ed7692cbd7ce83b45fb2def99f706e54@redacted",
            "2e412037e4ae29ab88a0650fd5c00fdd@redacted",
            "d73f777c979e58a6820a9524f5bae777@redacted",
            "d66b7793f9d572830b257b57735f92c8@redacted",
            "93dba740766b38c20d2e3bcf196acd5a@redacted",
            "cd2a30f194022ec8f1cf3f6ac58666d4@redacted",
            "7826d1013018e53f3d0a85291cc76eb7@redacted",
            "de4ed425fc0f281bada51bb1bc671dbf@redacted",
            "05b5193ec2b2bedaf1adbc6ba7b80332@redacted",
            "1fa9c0859f9e0a5d577776e722024443@redacted",
            "ace69c287c21d47deac8c598399dc5de@redacted",
            "3e8af782cc52a78ce06baa4c5616462f@redacted",
            "fb4721022090165ac55e5c91092899a4@redacted",
            "81642ff59d0b1ac9c46247612f18459f@redacted",
            "456287540d0114cf51b49e5af5630be1@redacted",
            "bb80a34cedf6ee7b1e230fb943620b49@redacted",
            "55ea1f14c95abcb94ab479a8709711fb@redacted",
            "55ea1f14c95abcb94ab479a8709711fb@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "55ea1f14c95abcb94ab479a8709711fb@redacted"
    },
    {
        "subject": "9ca2ed7be6578a0c4fa2fd057bb4a141@redacted",
        "id": "0c64684d7dab73da21dbacd98e49a421@redacted",
        "references": [
            "fca48ccf310a474900d362b7879e9096@redacted",
            "4a6ae17d284ef7cabe4d2a9771befb83@redacted",
            "fc0ed918d838cf01e9bbc41f178e48bb@redacted",
            "fc0ed918d838cf01e9bbc41f178e48bb@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "fc0ed918d838cf01e9bbc41f178e48bb@redacted"
    },
    {
        "subject": "465ed63965f16b02c0bd7ab3444f12fb@redacted",
        "id": "a6c14dcb63b36adcc582da719a2f48ec@redacted",
        "references": [
            "ed7692cbd7ce83b45fb2def99f706e54@redacted",
            "2e412037e4ae29ab88a0650fd5c00fdd@redacted",
            "d73f777c979e58a6820a9524f5bae777@redacted",
            "d66b7793f9d572830b257b57735f92c8@redacted",
            "93dba740766b38c20d2e3bcf196acd5a@redacted",
            "cd2a30f194022ec8f1cf3f6ac58666d4@redacted",
            "7826d1013018e53f3d0a85291cc76eb7@redacted",
            "de4ed425fc0f281bada51bb1bc671dbf@redacted",
            "05b5193ec2b2bedaf1adbc6ba7b80332@redacted",
            "1fa9c0859f9e0a5d577776e722024443@redacted",
            "ace69c287c21d47deac8c598399dc5de@redacted",
            "3e8af782cc52a78ce06baa4c5616462f@redacted",
            "fb4721022090165ac55e5c91092899a4@redacted",
            "81642ff59d0b1ac9c46247612f18459f@redacted",
            "456287540d0114cf51b49e5af5630be1@redacted",
            "bb80a34cedf6ee7b1e230fb943620b49@redacted",
            "55ea1f14c95abcb94ab479a8709711fb@redacted",
            "55ea1f14c95abcb94ab479a8709711fb@redacted"
        ],
        "databaseId": <redacted>,
        "threadRootId": "55ea1f14c95abcb94ab479a8709711fb@redacted"
    }
]
user@host:~$ sudo -u webserver-user php <pathToOcc>/occ mail:account:export-threads  -vvv -r <accountId> | grep databaseId
        "databaseId": <redacted>,
        "databaseId": <redacted>,
        "databaseId": <redacted>,
        "databaseId": <redacted>,
        "databaseId": <redacted>,
        "databaseId": <redacted>,
user@host:~$ sudo -u webserver-user php <pathToOcc>/occ mail:account:export-threads  -vvv -r <accountId> | grep databaseId | 
c -l
6
user@host:~$ 
Mail app version

3.2.0

Mailserver or service

Gmail

Operating system

Ubuntu 22.04.2 LTS

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database

PostgreSQL

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the mail:account:export-threads occ command and reproduce the report using a Gmail account with multiple messages and -r output. Trace how thread messages and databaseId values are collected; done means JSON output includes every email's databaseId rather than only six, with coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.