fix(xo-server-cloud): check token before getResourceDownloadToken call (#2783)

This commit is contained in:
Pierre Donias 2018-03-20 15:36:03 +01:00 committed by Julien Fontanet
parent 4cac99d79a
commit ff59d091f1

View File

@ -128,10 +128,15 @@ class XoServerCloud {
throw new Error(`cannot get resource: ${namespace} not registered`)
}
const namespaceCatalog = await this._getNamespaceCatalog(namespace)
const { _token: token } = await this._getNamespaceCatalog(namespace)
// 2018-03-20 Extra check: getResourceDownloadToken seems to be called without a token in some cases
if (token === undefined) {
throw new Error(`${namespace} namespace token is undefined`)
}
const downloadToken = await this._updater.call('getResourceDownloadToken', {
token: namespaceCatalog._token,
token,
id,
version,
})