Closed Bug 1684327 Opened 5 years ago Closed 4 years ago

messenger.accounts.list() might fail if some folder name contains '%'-sign

Categories

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

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1707408

People

(Reporter: G.Gersdorf, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

Find an imap server which allows to create folders with '%'-sign in the name (not all imap server allows this)
Create a folder name 'abc% def' (the imap server i've used for tests allows this but not 'abc%def')
Open a debugger window for an arbitrary add-on
Enter 'await messenger.accounts.list();'

Actual results:

malformed URI sequence ext-mail.js:1473
Uncaught (in promise) Error: An unexpected error occurred

Expected results:

Should return a list of accounts.

ext-mail.js:1473 is the function
function folderURIToPath(uri) {
let path = Services.io.newURI(uri).filePath;
return path
.split("/")
.map(decodeURIComponent) <--
.join("/");
}
which is called when the subfolders of an account are traversed.

This function is called with a 'folder.URI', which (in my test) returns
"imap://name@imap.web.de/abc% def"
decodeURIComponent throws the error if it tries to decode this because of the %-sign
(folder.folderURL returns imap://name@imap.web.de/abc%25%20def)

This problem does not happens with folders in the 'local folders' account. In this case folder.URI returns mailbox://nobody@Local%20Folders/abc%25%20def

Just to note: "Crash" normally refers to a crash of the application or process, not an error thrown in response to bad input.

Summary: messenger.accounts.list() might crash if some folder name contains '%'-sign → messenger.accounts.list() might fail if some folder name contains '%'-sign
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.