Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a save bug that occurs when changing a request/folder name #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

APIWT
Copy link
Contributor

@APIWT APIWT commented Sep 22, 2021

If you were to save a workbook after changing a request or folder name, it would take the following actions:

  • Use the in-memory filesystem to create a workbook.json file with the details of the workbook.
  • Loop through the in-memory workbook's folders and requests, then create a file on the host filesystem.

However, as a result, it ends up leaving the old (pre-renamed) request/folders on the filesystem, meaning the next time you load the workbook you end up with a duplicate.

This patch changes this behavior by instead taking these actions:

  • Create a backup of the host filesystem's workbook files (workbook.json and all the folder/request JSONs) inside the .sgbackup
  • Delete the host filesystem's workbook files
  • Use the in-memory filesystem to create a workbook.json file with the details of the workbook.
  • Loop through the in-memory workbook's folders and requests, then create a file on the host filesystem.

This seems to work, but in the future it might make sense to change this approach.

The nice thing about this approach is that it should be possible to load directly from the backup if necessary.

If you were to save a workbook after changing a request or folder name, it would take the following actions:

- Use the in-memory filesystem to create a workbook.json file with the details of the workbook.
- Loop through the in-memory workbook's folders and requests, then create a file on the host filesystem.

However, as a result, it ends up leaving the old (pre-renamed) request/folders on the filesystem, meaning the next time you load the workbook you end up with a duplicate.

This patch changes this behavior by instead taking these actions:

- Create a backup of the host filesystem's workbook files (workbook.json and all the folder/request JSONs) inside the .sgbackup
- Delete the host filesystem's workbook files
- Use the in-memory filesystem to create a workbook.json file with the details of the workbook.
- Loop through the in-memory workbook's folders and requests, then create a file on the host filesystem.

This seems to work, but in the future it might make sense to change this approach.

The nice thing about this approach is that it should be possible to load directly from the backup if necessary.
@APIWT
Copy link
Contributor Author

APIWT commented Sep 22, 2021

This should fix #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant