-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Description
⚡ Describe the Bug
Template records stored in the SQLite database (fireform.db) contain absolute file paths to PDF files on the original machine. After re-cloning the repository, moving the project directory, or onboarding on a new machine, all existing template records point to non-existent paths.
This causes silent failures or 500 Internal Server Error on POST /forms/fill with no clear error message.
📉 Expected Behavior
Template records should either:
- Store relative paths anchored to the project root
- Validate that the referenced PDF exists on disk when a template is loaded
🕵️ Steps to Reproduce
- Clone the repository and set up FireForm on Machine A
- Upload a PDF template via
POST /templates/upload - Re-clone the repository on Machine B (or move the project folder)
- Attempt
POST /forms/fillwith a previously registered template - Observe:
500 Internal Server Error
🩹 Temporary Workaround
Reset the database manually:
python -c "
import sqlite3
c = sqlite3.connect('fireform.db')
c.execute('DELETE FROM template')
c.execute('DELETE FROM formsubmission')
c.commit()
print('Database cleared.')
"💡 Proposed Fix
- Store template PDF paths as relative paths from project root (e.g.
src/templates/fire_dept.pdf) instead of absolute paths - Add path existence check in the template repository layer
- Add a
scripts/reset_db.pyhelper script - Document this behaviour clearly in
SETUP.md
✅ Acceptance Criteria
- Template paths stored as relative paths
- Validation on template load — clear 404 if PDF missing
-
scripts/reset_db.pyutility added -
SETUP.mdupdated with database reset instructions - New contributor setup works cleanly on a fresh clone
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels