#1714: fixing minor error in test + adding a check for existing uuid when adding file

This commit is contained in:
Czar Echavez
2023-08-09 11:19:58 +01:00
parent 2f27e02877
commit 572f457231
2 changed files with 16 additions and 7 deletions

View File

@@ -25,9 +25,13 @@ class FileSystemFolder(FileSystemItem):
if file is None or not isinstance(file, FileSystemFile):
raise Exception(f"Invalid file: {file}")
# add to list
self.files[file.uuid] = file
self.size += file.size
# check if file with id already exists in folder
if self.get_file_by_id(file.uuid) is not None:
_LOGGER.debug(f"File with id {file.uuid} already exists in folder")
else:
# add to list
self.files[file.uuid] = file
self.size += file.size
def remove_file(self, file: Optional[FileSystemFile]):
"""