feat: add unauthenticated /share/attachment/[id] route for shared bill attachments

- Add /share/attachment/.* to public pages in middleware.ts
- Create new /share/attachment/[id] route handler for downloading attachments without authentication
- Add custom 404 page for missing shared attachments
- Update ViewBillCard component to use shared attachment route instead of authenticated route

This enables attachment downloads from shared bill pages without requiring user login.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-08 13:57:53 +02:00
parent cd2d8f5ab9
commit e84188baf2
4 changed files with 35 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ export const ViewBillCard:FC<ViewBillCardProps> = ({ location, bill }) => {
attachment ?
<span className="textarea textarea-bordered max-w-[400px] w-full grow">
<p className="font-bold uppercase">{t("attachment")}</p>
<Link href={`/attachment/${locationID}-${billID}/`} target="_blank" className='text-center w-full max-w-[20em] text-nowrap truncate inline-block mt-2'>
<Link href={`/share/attachment/${locationID}-${billID}/`} target="_blank" className='text-center w-full max-w-[20em] text-nowrap truncate inline-block mt-2'>
<DocumentIcon className="h-[1em] w-[1em] text-2xl inline-block mr-1" />
{decodeURIComponent(attachment.fileName)}
</Link>