Base64 the folder persistent id.

Bug: 8596345
Change-Id: Ib7025fa54abb12f7c65628639819d06fb530c7ed
This commit is contained in:
Yu Ping Hu 2013-04-11 19:51:19 -07:00
parent 196cb96ea8
commit 9b040bde34
1 changed files with 20 additions and 0 deletions

View File

@ -45,6 +45,7 @@ import android.os.RemoteException;
import android.provider.BaseColumns;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Base64;
import android.util.Log;
import com.android.common.content.ProjectionMap;
@ -2730,6 +2731,25 @@ outer:
}
values.put(UIProvider.FolderColumns.CAPABILITIES,
getFolderCapabilities(info, mailbox.mFlags, mailbox.mType, mailboxId));
// The persistent id is used to form a filename, so we must ensure that it doesn't
// include illegal characters (such as '/'). Only perform the encoding if this
// query wants the persistent id.
boolean shouldEncodePersistentId = false;
if (uiProjection == null) {
shouldEncodePersistentId = true;
} else {
for (final String column : uiProjection) {
if (TextUtils.equals(column, UIProvider.FolderColumns.PERSISTENT_ID)) {
shouldEncodePersistentId = true;
break;
}
}
}
if (shouldEncodePersistentId) {
values.put(UIProvider.FolderColumns.PERSISTENT_ID,
Base64.encodeToString(mailbox.mServerId.getBytes(),
Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING));
}
}
}
StringBuilder sb = genSelect(getFolderListMap(), uiProjection, values);