filr_rest: accept invalid email in share-folder endpoint (#79207)
gitea/passerelle/pipeline/head This commit looks good Details

This commit is contained in:
Thomas NOËL 2023-06-29 10:55:52 +02:00
parent 34e0b6f8d8
commit 1afe1a8649
2 changed files with 3 additions and 4 deletions

View File

@ -129,7 +129,7 @@ class Filr(BaseResource, HTTPResource):
def share_folder(self, request, post_data):
data = []
for email in post_data['emails']:
if email and '@' in email:
if email:
share_info = self._call(
'rest/folders/%s/shares' % post_data['folder_id'],
method='post',

View File

@ -87,7 +87,7 @@ def test_share_folder(app, connector):
'emails/0': 'foo@example.net',
'emails/1': '',
'emails/2': None,
'emails/3': 'not a mail',
'emails/3': "not-a-mail but it's ok",
'emails/4': 'bar@example.org',
'days_to_expire': '30',
}
@ -96,13 +96,12 @@ def test_share_folder(app, connector):
resp = app.post_json('/filr-rest/filr/share-folder', params=params)
json_resp = resp.json
assert json_resp['err'] == 0
assert json_resp['data'] == [{'id': 9}, {'id': 9}]
assert json_resp['data'] == [{'id': 9}, {'id': 9}, {'id': 9}]
params = {
'folder_id': '1234',
'emails/0': '',
'emails/1': None,
'emails/2': 'not a mail',
'days_to_expire': '30',
}
with responses.RequestsMock():