fix: unwrap async params in download route segment

### Issue:
Next.js App Router expects params to be a Promise that must be awaited before accessing properties.

### Error:
```
Route "/download/[...segments]" used `params.segments`.
`params` is a Promise and must be unwrapped with `await`
or `React.use()` before accessing its properties.
```

### Solution:
- Made component async: `export default async function DownloadListing`
- Updated params type: `Promise<{ segments: string[] }>`
- Unwrapped with await: `const { segments: rawSegments } = await params`

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Haitao Pan 2025-11-11 17:10:00 +08:00
parent ee1894b146
commit c9ce622525
2 changed files with 4 additions and 4 deletions

View File

@ -68,12 +68,12 @@ function getLatestModified(listing: DirListing): string | undefined {
return latest
}
export default function DownloadListing({
export default async function DownloadListing({
params,
}: {
params: { segments: string[] }
params: Promise<{ segments: string[] }>
}) {
const rawSegments = params.segments ?? []
const { segments: rawSegments } = await params
const segments = rawSegments
.map((segment) => segment.trim().replace(/\/+$/g, ''))
.filter((segment) => segment.length > 0)

File diff suppressed because one or more lines are too long