Skip to content

Commit

Permalink
Allow user files to be overwritten
Browse files Browse the repository at this point in the history
Fixes ecotaxa#57.
  • Loading branch information
moi90 committed Feb 16, 2023
1 parent 2ff03f0 commit bc09178
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions py/FS/UserDir.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ async def add_file(self, name: str, path: Optional[str], stream: Any) -> str:
base_path /= path[:-len(name)]
TempDirForTasks.ensure_exists(base_path, self.user_dir_cache)
dest_path = base_path.absolute().joinpath(name)
# TODO: Should be an option
if dest_path.exists():
return str(dest_path)

# Copy data from the stream into dest_path
with open(dest_path, "wb") as fout:
buff = await stream.read(1024)
while len(buff) != 0:
Expand Down

0 comments on commit bc09178

Please sign in to comment.