fix(xo-server): check remote is enabled even when bound to proxy (#5501)

This commit is contained in:
badrAZ
2021-01-14 17:37:30 +01:00
committed by GitHub
parent 3e25b92369
commit 70083c6dca

View File

@@ -87,7 +87,8 @@ export default class {
}
async testRemote(remoteId) {
const remote = await this._getRemote(remoteId)
const remote = await this.getRemoteWithCredentials(remoteId)
const { readRate, writeRate, ...answer } =
remote.proxy !== undefined
? await this._xo.callProxyMethod(remote.proxy, 'remote.test', {
@@ -150,8 +151,12 @@ export default class {
return remote.properties
}
getRemoteWithCredentials(id) {
return this._getRemote(id)
async getRemoteWithCredentials(id) {
const remote = await this._getRemote(id)
if (!remote.enabled) {
throw new Error('remote is disabled')
}
return remote
}
getRemote(id) {