Forum Archive

[Bug] "Set File Contents" not overwriting file in Dropbox.

WyldKard

I created a Workflow that uses the "Set File Contents" feature. When I call the actual block (from the pre-populated Workflow sets) there's no problem - a file I specify on Dropbox is properly overwritten.

However, in the same workflow I also want to save a file whose name is dynamic - I'm pulling the filename from the contents of another file. As such, I store the filename in a variable, which means I can't use the "Set File Contents" Workflow block, so instead I run a custom Python script and call:

editor.set_file_contents( filepath, action_in.encode('utf8'), 'dropbox')

What happens is if the file doesn't exist, it's created and the contents are set correctly. If the file does exist, however, a new file is created, with the same filename and " (n)" added to the end, where n is a number. So, if I call the workflow three times, I get:

filename.md
filename (1).md
filename (2).md

Is there a reason the file is not being overwritten correctly, or is this a bug?

omz

This seems to be a bug. However, as I've mentioned here, you can use a variable in the filename field of the Set File Contents action.

WyldKard

Great - I'll modify my workflow to use the block then instead of setting file contents from a script, until this gets fixed. Thanks for the quick reply!

bevesce

Hi,
will this bug be fixed somewhere in the near future?