Consolidate local images under data/images/, add docker migrate CLI, startup index sync with orphan cleanup, and remove upload folder UI/API.
21 lines
457 B
TypeScript
21 lines
457 B
TypeScript
export function contentTypeFromKey(key: string): string {
|
|
const ext = key.split('.').pop()?.toLowerCase()
|
|
switch (ext) {
|
|
case 'jpg':
|
|
case 'jpeg':
|
|
return 'image/jpeg'
|
|
case 'png':
|
|
return 'image/png'
|
|
case 'gif':
|
|
return 'image/gif'
|
|
case 'webp':
|
|
return 'image/webp'
|
|
case 'svg':
|
|
return 'image/svg+xml'
|
|
case 'ico':
|
|
return 'image/x-icon'
|
|
default:
|
|
return 'application/octet-stream'
|
|
}
|
|
}
|