guard against incorrect types in /auth/

pull/1/head
ansuz 5 years ago
parent e5bcaeedce
commit dca2707ae3

@ -71,7 +71,7 @@ define([
// Get contacts and extract their avatar channel and key // Get contacts and extract their avatar channel and key
var getData = function (obj, href) { var getData = function (obj, href) {
var parsed = Hash.parsePadUrl(href); var parsed = Hash.parsePadUrl(href);
if (!parsed || parsed.type !== "file") { return; } // XXX if (!parsed || parsed.type !== "file") { return; }
var secret = Hash.getSecrets('file', parsed.hash); var secret = Hash.getSecrets('file', parsed.hash);
if (!secret.keys || !secret.channel) { return; } if (!secret.keys || !secret.channel) { return; }
obj.avatarKey = Hash.encodeBase64(secret.keys && secret.keys.cryptKey); obj.avatarKey = Hash.encodeBase64(secret.keys && secret.keys.cryptKey);
@ -81,7 +81,7 @@ define([
contacts.friends = proxy.friends || {}; contacts.friends = proxy.friends || {};
Object.keys(contacts.friends).map(function (key) { Object.keys(contacts.friends).map(function (key) {
var friend = contacts.friends[key]; var friend = contacts.friends[key];
// if (!friend) { return; } // XXX how should this be handled? if (!friend) { return; }
var ret = { var ret = {
edPublic: friend.edPublic, edPublic: friend.edPublic,
name: friend.displayName, name: friend.displayName,
@ -91,7 +91,7 @@ define([
}); });
Object.keys(contacts.teams).map(function (key) { Object.keys(contacts.teams).map(function (key) {
var team = contacts.teams[key]; var team = contacts.teams[key];
// if (!team) { return; } // XXX how should this be handled. Is this possible? if (!team) { return; }
var avatar = team.metadata && team.metadata.avatar; var avatar = team.metadata && team.metadata.avatar;
var ret = { var ret = {
edPublic: team.keys && team.keys.drive && team.keys.drive.edPublic, edPublic: team.keys && team.keys.drive && team.keys.drive.edPublic,

Loading…
Cancel
Save