Skip to content

Commit 9f8e06d

Browse files
author
Sebastian Kippe
committed
Fix remote.storageApi not being set correctly
Some places that should be using storageApi are setting storageType. But the latter is supposed to be a different property, albeit related in functionality.
1 parent 7e828c1 commit 9f8e06d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/discover.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var cachedInfo = {};
2121
*
2222
* @returns {Promise} A promise for an object with the following properties.
2323
* href - Storage base URL,
24-
* storageType - Storage type,
24+
* storageApi - RS protocol version,
2525
* authUrl - OAuth URL,
2626
* properties - Webfinger link properties
2727
**/
@@ -52,11 +52,16 @@ const Discover = function Discover(userAddress) {
5252
var rs = response.idx.links.remotestorage[0];
5353
var authURL = rs.properties['http://tools.ietf.org/html/rfc6749#section-4.2'] ||
5454
rs.properties['auth-endpoint'];
55-
var storageType = rs.properties['http://remotestorage.io/spec/version'] ||
56-
rs.type;
55+
var storageApi = rs.properties['http://remotestorage.io/spec/version'] ||
56+
rs.type;
5757

5858
// cache fetched data
59-
cachedInfo[userAddress] = { href: rs.href, storageType: storageType, authURL: authURL, properties: rs.properties };
59+
cachedInfo[userAddress] = {
60+
href: rs.href,
61+
storageApi: storageApi,
62+
authURL: authURL,
63+
properties: rs.properties
64+
};
6065

6166
if (hasLocalStorage) {
6267
localStorage[SETTINGS_KEY] = JSON.stringify({ cache: cachedInfo });

src/remotestorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ RemoteStorage.prototype = {
178178
* @param {string} cordovaRedirectUri
179179
*/
180180
authorize: function authorize(authURL, cordovaRedirectUri) {
181-
this.access.setStorageType(this.remote.storageType);
181+
this.access.setStorageType(this.remote.storageApi);
182182
var scope = this.access.scopeParameter;
183183

184184
var redirectUri = globalContext.cordova ? cordovaRedirectUri : String(Authorize.getLocation());

0 commit comments

Comments
 (0)