bolt icon indicating copy to clipboard operation
bolt copied to clipboard

`download_file` shouldn't be destructive

Open Ziaunys opened this issue 2 years ago • 0 comments

Describe the Bug

The built-in download_file function is destructive and will remove existing files of the destination directory. This is a problem when trying to download multiple files from a target that would result in calling download_file twice.

This might not be considered a bug, but it is definitely undesirable behavior from my point of view.

Expected Behavior

Stop removing files. Overwrite behavior is probably fine, but I can imagine situations where that wouldn't be desirable. Perhaps this could be a config option.

Steps to Reproduce

Steps to reproduce the behavior: From a single plan perform the following actions:

  1. Call download_file('/src/foo.txt', 'foo.txt', $target)
  2. Call download_file('/src/bar.txt', 'bar.txt', $target)
  3. Inspect downloads/<target> to see that foo.txt has been deleted.

Environment

  • Version 3.26.1
  • Platform Ubuntu 20.04

Ziaunys avatar Mar 13 '23 18:03 Ziaunys