Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'jb36304' into 'master'
Browse files Browse the repository at this point in the history
[buteo-sync-plugins-social] Ensure backup blobs have url-safe names. Contributes to JB#36304

Base64 encoded names are not URL safe (they can contain / and + etc).
This commit ensures that we use the URL-safe encoding for backup blobs.

Contributes to JB#36304

See merge request !20
  • Loading branch information
chriadam committed Sep 20, 2016
2 parents 4e71880 + b6220c4 commit 050d860
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dropbox/dropbox-backup/dropboxbackupsyncadaptor.cpp
Expand Up @@ -74,7 +74,7 @@ void DropboxBackupSyncAdaptor::beginSync(int accountId, const QString &accessTok
SsuDeviceInfo deviceInfo;
QString deviceId = deviceInfo.deviceUid();
QByteArray hashedDeviceId = QCryptographicHash::hash(deviceId.toUtf8(), QCryptographicHash::Sha256);
QString encodedDeviceId = QString::fromUtf8(hashedDeviceId.toBase64()).mid(0,12);
QString encodedDeviceId = QString::fromUtf8(hashedDeviceId.toBase64(QByteArray::Base64UrlEncoding)).mid(0,12);
if (deviceId.isEmpty()) {
SOCIALD_LOG_ERROR("Could not determine device identifier; cannot create remote per-device backup directory!");
setStatus(SocialNetworkSyncAdaptor::Error);
Expand Down
2 changes: 1 addition & 1 deletion src/onedrive/onedrive-backup/onedrivebackupsyncadaptor.cpp
Expand Up @@ -108,7 +108,7 @@ void OneDriveBackupSyncAdaptor::beginSync(int accountId, const QString &accessTo
SsuDeviceInfo deviceInfo;
QString deviceId = deviceInfo.deviceUid();
QByteArray hashedDeviceId = QCryptographicHash::hash(deviceId.toUtf8(), QCryptographicHash::Sha256);
QString encodedDeviceId = QString::fromUtf8(hashedDeviceId.toBase64()).mid(0,12);
QString encodedDeviceId = QString::fromUtf8(hashedDeviceId.toBase64(QByteArray::Base64UrlEncoding)).mid(0,12);
if (deviceId.isEmpty()) {
SOCIALD_LOG_ERROR("Could not determine device identifier; cannot create remote per-device backup directory!");
setStatus(SocialNetworkSyncAdaptor::Error);
Expand Down

0 comments on commit 050d860

Please sign in to comment.