v2.6.51: fix PDF import — raise UI body limit, wire real analyze
- docker-compose.yml: BODY_SIZE_LIMIT=52428800 (50MB) on UI service — adapter-node was rejecting PDFs >512KB with 'Content-length exceeds limit' - storage/import.go: add AnalyzeFile() public function using real PDF/EPUB parsers - handlers_import.go: analyzeImportFile() now calls storage.AnalyzeFile() instead of the file-size stub, so chapter count is accurate in the preview
This commit is contained in:
@@ -127,16 +127,17 @@ func (s *Server) handleAdminImport(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
// analyzeImportFile does a quick scan of the file to count chapters.
|
||||
// This is a placeholder - real implementation would parse PDF/EPUB properly.
|
||||
// analyzeImportFile parses the file to count chapters and extract preview lines.
|
||||
func analyzeImportFile(data []byte, fileType string) *importPreview {
|
||||
// TODO: Implement actual PDF/EPUB parsing to count chapters
|
||||
// For now, estimate based on file size
|
||||
preview := &importPreview{
|
||||
Chapters: estimateChapters(data, fileType),
|
||||
FirstLines: []string{},
|
||||
count, firstLines, err := storage.AnalyzeFile(data, fileType)
|
||||
if err != nil || count == 0 {
|
||||
// Fall back to rough size estimate so the UI still shows something
|
||||
count = estimateChapters(data, fileType)
|
||||
}
|
||||
return &importPreview{
|
||||
Chapters: count,
|
||||
FirstLines: firstLines,
|
||||
}
|
||||
return preview
|
||||
}
|
||||
|
||||
func estimateChapters(data []byte, fileType string) int {
|
||||
|
||||
Reference in New Issue
Block a user