Skip to content

Commit e5c9345

Browse files
committed
Support copying files to a directory
Since commit dbe0b11 the `copy()` function no longer supports copying files to a directory. The change in behaviour has lead to at least one regression[1]. This restore the previous behaviour. [1] #3442
1 parent 3c69dc6 commit e5c9345

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pelican/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ def walk_error(err):
366366

367367
def copy_file(source: str, destination: str) -> None:
368368
"""Copy a file"""
369+
if os.path.isdir(destination):
370+
destination = os.path.join(destination, os.path.basename(source))
371+
369372
try:
370373
shutil.copyfile(source, destination)
371374
except OSError as e:

0 commit comments

Comments
 (0)