Fix invoice file 500 and pdf.worker MIME error

- Remove stale import of non-existent require_cap_from_token from
  get_invoice_file endpoint — caused ImportError → 500 on every PDF load
- Fix pdf.js worker path from '/pdf.worker.min.mjs' to '/kitchen/pdf.worker.min.mjs'
  in Review.tsx and SearchDefinitions.tsx — worker was being fetched from domain
  root instead of under the /kitchen/ base, causing MIME type rejection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-12 21:28:55 +00:00
parent 1502ab8ed2
commit cd9e7dbfef
3 changed files with 2 additions and 3 deletions

View file

@ -1237,7 +1237,6 @@ async def get_invoice_file(
db: AsyncSession = Depends(get_db)
):
"""Get invoice file (image or PDF) with token in query param - works through proxies"""
from auth import get_current_user, require_cap_from_token
from starlette.responses import Response
from services.file_archival_service import FileArchivalService

View file

@ -13,7 +13,7 @@ import IngredientModal from './IngredientModal'
import { IngredientModalResult, LineItemResult } from '../utils/ingredientHelpers'
// Use local worker file from public directory
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs'
pdfjsLib.GlobalWorkerOptions.workerSrc = '/kitchen/pdf.worker.min.mjs'
// Simple Scale icon SVG component
const ScaleIcon = ({ style }: { style?: React.CSSProperties }) => (

View file

@ -15,7 +15,7 @@ import {
import * as pdfjsLib from 'pdfjs-dist'
// Configure PDF.js worker
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs'
pdfjsLib.GlobalWorkerOptions.workerSrc = '/kitchen/pdf.worker.min.mjs'
interface ProductDefinition {
id: number