Closed Bug 1600826 Opened 4 years ago Closed 4 years ago

"messages.list" errors while listing messages of a folder if the folder path contains spaces

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1588391

People

(Reporter: will.siddall, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

Trying to messages of a folder but each time returns the error "folder is null".
Referring to the example at https://thunderbird-webextensions.readthedocs.io/en/latest/how-to/messageLists.html:

let page = await browser.messages.list(mailFolder);

Actual results:

The return line in the list() function because the folder variable is null. That means calling "getFolderForURL" returns a null object.

Debugging the "list()" function:
async list({ accountId, path }) {
let uri = folderPathToURI(accountId, path);
let folder = MailServices.folderLookup.getFolderForURL(uri);

return messageListTracker.startList(
folder.messages,
context.extension
);
}

the line retrieving the folder is what raised the error, but after implementing a testing add-on that recreates the steps in this function shows the "folderPathToURI" is what is causing the problem. Specifically, the return line where the path is URI encoded:

return (rootURI + path.split("/").map(encodeURIComponent).join("/"));

Recreating this method and leaving out the split and encoding, the method works and retrieves the contents of the folder. In my specific case, my folders contain spaces and after encoding this path, it adds a "%20" instead of a space. This encoding corrupts the URI. I even attempted to hardcode a URI with "+" instead of spaces and this still corrupted the URI. It must keep the spaces.

Expected results:

continues with no error and provides a messageList object with the list of messages in the folder.

(In reply to Will Siddall from comment #0)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0

Steps to reproduce:

Trying to messages of a folder but each time returns the error "folder is null".
Referring to the example at https://thunderbird-webextensions.readthedocs.io/en/latest/how-to/messageLists.html:

let page = await browser.messages.list(mailFolder);

Actual results:

The return line in the list() function because the folder variable is null. That means calling "getFolderForURL" returns a null object.

Debugging the "list()" function:
async list({ accountId, path }) {
let uri = folderPathToURI(accountId, path);
let folder = MailServices.folderLookup.getFolderForURL(uri);

return messageListTracker.startList(
folder.messages,
context.extension
);
}

the line retrieving the folder is what raised the error, but after implementing a testing add-on that recreates the steps in this function shows the "folderPathToURI" is what is causing the problem. Specifically, the return line where the path is URI encoded:

return (rootURI + path.split("/").map(encodeURIComponent).join("/"));

Recreating this method and leaving out the split and encoding, the method works and retrieves the contents of the folder. In my specific case, my folders contain spaces and after encoding this path, it adds a "%20" instead of a space. This encoding corrupts the URI. I even attempted to hardcode a URI with "+" instead of spaces and this still corrupted the URI. It must keep the spaces.

Expected results:

continues with no error and provides a messageList object with the list of messages in the folder.

Summary: "messages.list" errors while listing messages of a folder → "messages.list" errors while listing messages of a folder if the folder path contains spaces

What Thunderbird version are you using? This looks like bug 1588391 but that was fixed in 68.2.

(In reply to Geoff Lankow (:darktrojan) from comment #2)

What Thunderbird version are you using? This looks like bug 1588391 but that was fixed in 68.2.

Using 68.1.2. I'll try getting that version and try again.

That appears to have fixed it. Upgrading to 68.2.2 resolved the issue.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.