Skip to content

Enhance session handling and filename sanitation#48

Open
VictorHarbo wants to merge 10 commits intobitdruid:mainfrom
WEB-CHILD:main
Open

Enhance session handling and filename sanitation#48
VictorHarbo wants to merge 10 commits intobitdruid:mainfrom
WEB-CHILD:main

Conversation

@VictorHarbo
Copy link
Contributor

This pull request introduces some minor improvements to database session handling and filename sanitation.
The changes focus on ensuring resources are properly closed to prevent leaks. Also, filename sanitation is improved to handle more special characters as we have encountered errors with question marks for instance. The work has been done by @jorntx and I.

Database session management and error handling:

  • Added commit/rollback logic and verbose logging to Database.close() in db.py, ensuring all pending transactions are handled and sessions are properly closed
  • Improved atomic row claiming and error handling in Snapshot.py when fetching and modifying snapshot records
  • Ensured that any created collection in the main workflow is closed cleanly, preventing resource leaks
  • Added a close() method to Worker.py to properly close database and HTTP connections with logging and error suppression

Filename and path sanitization:

  • Extended the list of disallowed/special characters in filename and path sanitization functions to prevent filesystem issues across platforms

jorntx and others added 6 commits January 9, 2026 15:40
@bitdruid bitdruid self-requested a review January 20, 2026 16:03
@bitdruid
Copy link
Owner

thank you i will check this out when ive enough time. meanwhile what are your thoughts about changes to the db into a single file (one table per request OR optional define a /etc/pywaybackup/config.yml for useing an existing sql / psql db)? id like to make this project more integratable into persistent infrastructures. currently im a bit playing around with a very simple flask ui. thats why i started implementing module functionality...

Copy link
Owner

@bitdruid bitdruid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after i reviewed your code i like the additional verbose output but i think it should be moved behind a "debug" flag. either if --debug is already set or --verbose debug (loglevels...) so maybe a good time to implement loglevels at all. also i would prefer a smaller naming for the unique snapshots-limit. something like --unique or other. just to keep it simple and clean. thank you for the good work

@bitdruid
Copy link
Owner

i added the necessary tier-system in 964c519

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.

3 participants