cleanup
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// src/pages/api/upload/media.ts - Enhanced with detailed logging and error handling
|
||||
import type { APIRoute } from 'astro';
|
||||
import { withAPIAuth } from '../../../utils/auth.js';
|
||||
import { apiResponse, apiError, apiServerError, apiSpecial, handleAPIRequest } from '../../../utils/api.js';
|
||||
@@ -21,13 +20,10 @@ interface UploadResult {
|
||||
const UPLOAD_CONFIG = {
|
||||
maxFileSize: 50 * 1024 * 1024, // 50MB
|
||||
allowedTypes: new Set([
|
||||
// Images
|
||||
'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml',
|
||||
|
||||
// Videos
|
||||
'video/mp4', 'video/webm', 'video/ogg', 'video/avi', 'video/mov',
|
||||
|
||||
// Documents
|
||||
'application/pdf',
|
||||
'application/msword',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
@@ -36,17 +32,15 @@ const UPLOAD_CONFIG = {
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
|
||||
// Text files
|
||||
'text/plain',
|
||||
'text/csv',
|
||||
'text/markdown', // Added markdown
|
||||
'text/x-markdown', // Alternative markdown MIME type
|
||||
'text/markdown',
|
||||
'text/x-markdown',
|
||||
'application/json',
|
||||
'application/xml',
|
||||
'text/xml',
|
||||
'text/html',
|
||||
|
||||
// Archives
|
||||
'application/zip',
|
||||
'application/x-tar',
|
||||
'application/gzip',
|
||||
@@ -55,10 +49,9 @@ const UPLOAD_CONFIG = {
|
||||
'application/x-rar-compressed',
|
||||
'application/x-7z-compressed',
|
||||
|
||||
// Additional useful formats
|
||||
'application/rtf', // Rich Text Format
|
||||
'application/rtf',
|
||||
'text/richtext',
|
||||
'application/x-yaml', // YAML files
|
||||
'application/x-yaml',
|
||||
'text/yaml',
|
||||
'application/yaml'
|
||||
]),
|
||||
@@ -185,7 +178,6 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
return await handleAPIRequest(async () => {
|
||||
console.log('[UPLOAD] Processing upload request');
|
||||
|
||||
// Enhanced auth logging
|
||||
const authResult = await withAPIAuth(request, 'contributions');
|
||||
console.log('[UPLOAD] Auth result:', {
|
||||
authenticated: authResult.authenticated,
|
||||
@@ -230,7 +222,6 @@ export const POST: APIRoute = async ({ request }) => {
|
||||
return apiError.badRequest(validation.error!);
|
||||
}
|
||||
|
||||
// Enhanced environment logging
|
||||
const nextcloudConfigured = isNextcloudConfigured();
|
||||
console.log('[UPLOAD] Environment check:', {
|
||||
nextcloudConfigured,
|
||||
|
||||
Reference in New Issue
Block a user