Skip to content

Commit

Permalink
Fix bug in collapsing/expanding folders with some special characters …
Browse files Browse the repository at this point in the history
…in names (#9324)
  • Loading branch information
alecpl committed Jan 28, 2024
1 parent 549f99c commit a1c74eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Makefile: Use phpDocumentor v3.4 for the Framework docs (#9313)
- Fix bug where HTML entities in URLs were not decoded on HTML to plain text conversion (#9312)
- Fix bug in collapsing/expanding folders with some special characters in names (#9324)

## Release 1.6.6

Expand Down
11 changes: 5 additions & 6 deletions program/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1765,20 +1765,19 @@ function rcube_webmail()
clearTimeout(this.folder_collapsed_timer);

var prefname = this.env.task == 'addressbook' ? 'collapsed_abooks' : 'collapsed_folders',
old = this.env[prefname];
old = this.env[prefname],
entry = '&' + urlencode(node.id) + '&';

this.env[prefname] = old.replace(entry, '');

if (node.collapsed) {
this.env[prefname] = this.env[prefname] + '&'+urlencode(node.id)+'&';
this.env[prefname] = this.env[prefname] + entry;

// select the folder if one of its children is currently selected
// don't select if it's virtual (#1488346)
if (!node.virtual && this.env.mailbox && this.env.mailbox.startsWith(node.id + this.env.delimiter))
this.command('list', node.id);
}
else {
var reg = new RegExp('&'+urlencode(node.id)+'&');
this.env[prefname] = this.env[prefname].replace(reg, '');
}

if (!this.drag_active) {
if (old !== this.env[prefname])
Expand Down
12 changes: 5 additions & 7 deletions program/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,12 @@ function rcube_clone_object(obj)
// make a string URL safe (and compatible with PHP's rawurlencode())
function urlencode(str)
{
if (window.encodeURIComponent)
return encodeURIComponent(str).replace('*', '%2A');

return escape(str)
.replace('+', '%2B')
return encodeURIComponent(str)
.replace('*', '%2A')
.replace('/', '%2F')
.replace('@', '%40');
.replace('(', '%28')
.replace(')', '%29')
.replace('!', '%21')
.replace("'", '%27');
};


Expand Down

0 comments on commit a1c74eb

Please sign in to comment.