# HG changeset patch # User Goffi # Date 1618590760 -7200 # Node ID 73b8a8d938be97eedb25ad9841fe7ad7ecdc53d1 # Parent a83a04b7394b42cba603a383d4233857d40c6b23 plugin XEP-0329: check files conflict also for root files diff -r a83a04b7394b -r 73b8a8d938be sat/plugins/plugin_xep_0329.py --- a/sat/plugins/plugin_xep_0329.py Fri Apr 16 18:32:37 2021 +0200 +++ b/sat/plugins/plugin_xep_0329.py Fri Apr 16 18:32:40 2021 +0200 @@ -1086,22 +1086,21 @@ client.sendError(iq_elt, 'forbidden', "You can't create a directory there") return # when going further into the path, the permissions will be checked by getFiles - if len(path.parts) > 2: - files_data = await self.host.memory.getFiles( - client, - peer_jid=peer_jid, - path=path.parent, - namespace=namespace, - owner=owner, + files_data = await self.host.memory.getFiles( + client, + peer_jid=peer_jid, + path=path.parent, + namespace=namespace, + owner=owner, + ) + if path.name in [d['name'] for d in files_data]: + log.warning( + f"Conflict when trying to create a directory (from: {peer_jid} " + f"namespace: {namespace!r} path: {path!r})" ) - if path.name in [d['name'] for d in files_data]: - log.warning( - f"Conflict when trying to create a directory (from: {peer_jid} " - f"namespace: {namespace!r} path: {path!r})" - ) - client.sendError( - iq_elt, 'conflict', "there is already a file or dir at this path") - return + client.sendError( + iq_elt, 'conflict', "there is already a file or dir at this path") + return try: configuration_elt = next(