Dedent by raising early.

This commit is contained in:
Ethan Dalool 2020-10-01 11:27:31 -07:00
parent 5609db3482
commit 400701f50d

View file

@ -427,7 +427,9 @@ class Mega:
files = [self._node_data(file) for file in files]
if all('h' in file and 'k' in file for file in files):
if not all('h' in file and 'k' in file for file in files):
raise errors.ValidationError('File id and key must be present')
request = [{'a': 'l', 'n': file['h']} for file in files]
public_handles = self._api_request(request)
if public_handles == -11:
@ -441,8 +443,6 @@ class Mega:
url = f'{self.schema}://{self.domain}/#!{public_handle}!{decrypted_key}'
urls.append(url)
return urls
else:
raise errors.ValidationError('File id and key must be present')
def _node_data(self, node):
if isinstance(node, dict):