In Preferences > Folders, decode path UTF7

This commit is contained in:
Ben Gotow 2017-10-14 17:37:17 -07:00
parent e572e6d186
commit 6fa52ca823

View file

@ -1,3 +1,4 @@
import utf7 from 'utf7';
import {
RetinaImg,
DropdownMenu,
@ -25,8 +26,8 @@ export default class CategorySelection extends React.Component {
_itemsForCategories() {
return this.props.all
.sort((a, b) => {
var pathA = a.path.toUpperCase();
var pathB = b.path.toUpperCase();
var pathA = utf7.imap.decode(a.path).toUpperCase();
var pathB = utf7.imap.decode(b.path).toUpperCase();
if (pathA < pathB) {
return -1;
}
@ -35,7 +36,7 @@ export default class CategorySelection extends React.Component {
}
return 0;
})
.filter(c => Utils.wordSearchRegExp(this.state.searchValue).test(c.path))
.filter(c => Utils.wordSearchRegExp(this.state.searchValue).test(utf7.imap.decode(c.path)))
.map(c => {
c.backgroundColor = LabelColorizer.backgroundColorDark(c);
return c;
@ -61,11 +62,13 @@ export default class CategorySelection extends React.Component {
);
}
const displayPath = utf7.imap.decode(item.path);
return (
<div className="category-item">
{icon}
<div className="category-display-name">
<BoldedSearchResult value={item.path} query={this.state.searchValue || ''} />
<BoldedSearchResult value={displayPath} query={this.state.searchValue || ''} />
</div>
</div>
);