Skip to content

Commit

Permalink
fix: can't capitalize file or folder name (infiniflow#798)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?


infiniflow#792 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored May 16, 2024
1 parent 94092b9 commit fcdeab7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions api/apps/document_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,10 @@ def rename():
data=False,
retmsg="The extension of file can't be changed",
retcode=RetCode.ARGUMENT_ERROR)
if DocumentService.query(name=req["name"], kb_id=doc.kb_id):
return get_data_error_result(
retmsg="Duplicated document name in the same knowledgebase.")
for d in DocumentService.query(name=req["name"], kb_id=doc.kb_id):
if d.name == req["name"]:
return get_data_error_result(
retmsg="Duplicated document name in the same knowledgebase.")

if not DocumentService.update_by_id(
req["doc_id"], {"name": req["name"]}):
Expand Down
7 changes: 4 additions & 3 deletions api/apps/file_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,10 @@ def rename():
data=False,
retmsg="The extension of file can't be changed",
retcode=RetCode.ARGUMENT_ERROR)
if FileService.query(name=req["name"], pf_id=file.parent_id):
return get_data_error_result(
retmsg="Duplicated file name in the same folder.")
for file in FileService.query(name=req["name"], pf_id=file.parent_id):
if file.name == req["name"]:
return get_data_error_result(
retmsg="Duplicated file name in the same folder.")

if not FileService.update_by_id(
req["file_id"], {"name": req["name"]}):
Expand Down

0 comments on commit fcdeab7

Please sign in to comment.