plugin XEP-0329: check files conflict also for root files
This commit is contained in:
parent
18cbbee1a5
commit
618917e0ef
1 changed files with 14 additions and 15 deletions
|
|
@ -1086,22 +1086,21 @@ class XEP_0329(object):
|
||||||
client.sendError(iq_elt, 'forbidden', "You can't create a directory there")
|
client.sendError(iq_elt, 'forbidden', "You can't create a directory there")
|
||||||
return
|
return
|
||||||
# when going further into the path, the permissions will be checked by getFiles
|
# 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(
|
||||||
files_data = await self.host.memory.getFiles(
|
client,
|
||||||
client,
|
peer_jid=peer_jid,
|
||||||
peer_jid=peer_jid,
|
path=path.parent,
|
||||||
path=path.parent,
|
namespace=namespace,
|
||||||
namespace=namespace,
|
owner=owner,
|
||||||
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]:
|
client.sendError(
|
||||||
log.warning(
|
iq_elt, 'conflict', "there is already a file or dir at this path")
|
||||||
f"Conflict when trying to create a directory (from: {peer_jid} "
|
return
|
||||||
f"namespace: {namespace!r} path: {path!r})"
|
|
||||||
)
|
|
||||||
client.sendError(
|
|
||||||
iq_elt, 'conflict', "there is already a file or dir at this path")
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
configuration_elt = next(
|
configuration_elt = next(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue