Both QR codes (in PDF and on dashboard) were pointing to /public/planes (the view page) instead of /public/planes/{id}/{slug}/download (the download endpoint).
- Changed
generatePublicQRCodeto generate QR codes pointing to the download endpoint - QR codes now encode:
{baseUrl}/public/planes/{planId}/{slug}/download
- Updated both
generateForPlanandregenerateForPlanmethods - Now stores the download URL in the
publicUrlfield
- Added logic to detect if existing QR codes point to the wrong URL
- Automatically regenerates QR codes that don't point to
/download - New QR codes generated during PDF creation will point to download endpoint
- Added a new "Download QR" section that shows the download URL
- QR Preview component still shows the QR code image (which now points to download)
- Users can copy the download URL directly
- New QR Codes: Generated with download URL from the start
- Existing QR Codes:
- When PDF is generated, the system checks if QR points to download
- If not, it regenerates the QR code with the correct download URL
- The new QR code is saved to the database
- Dashboard: Shows the download QR code and provides copy/test buttons
To verify the fix:
- Generate a new plan QR code
- Print the PDF - the QR code should point to
/download - Scan the QR from the PDF - it should download the PDF directly
- Check the dashboard - the download QR section should show the correct URL
- Existing plans: When you regenerate their PDF, the QR will be updated automatically