Qownnotes: creating multiple files in a script will overwrite each other

Created on 31 Oct 2019  路  5Comments  路  Source: pbek/QOwnNotes

Expected behaviour

I wrote a script to initialize a folder with two files. For reference the script can be found here: https://codeberg.org/bjoern/qownnote-scripts/src/branch/master/scripts/projectfolder/projectfolder.qml

I would expect that after calling the script two files "Overview.md" and "Next Steps.md" will be created.

Actual behaviour

Depending in the timing only "Next Step.md" will exists after running the script. This happens because initially the newly created file will have a filename like "Note 2019-10-30T21.32.42", then the content will be added and in a third step the file will be renamed according to the first line of the content. Before the rename took place the script already moved on to create the second file. If this is within the same second, the second file will be named "Note 2019-10-30T21.32.42" as well and overwrite the first file.

The problem could be solved if the file would be created directly with the final filename or allow the developer to specify a temporary filename as a second parameter when calling createNote()

Steps to reproduce

download my script and execute it in an empty folder.

Output from the debug section in the settings dialog

Relevant log output in the Log panel



Bug

Most helpful comment

Thank you for reporting. Will be fixed today.

All 5 comments

Thank you for reporting. Will be fixed today.

19.11.0

  • fixed a note naming problem with the scripting function createNote if it was
    called multiple times in the same second

There now is a new release, could you please test it and report if it works for you?

I tested it and it works great! Thanks a lot! :smile:

Great, thank you for testing!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrmotallebi picture mrmotallebi  路  8Comments

alexanderino picture alexanderino  路  7Comments

sanderboom picture sanderboom  路  5Comments

sanderboom picture sanderboom  路  5Comments

johanson picture johanson  路  5Comments