fix: resolve "no such file" error when processing non-English filenames in open-mineru (#11315)

This commit is contained in:
Carlton 2025-11-16 22:10:43 +08:00 committed by GitHub
parent 556353e910
commit 90b0c8b4a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,8 +72,8 @@ export default class OpenMineruPreprocessProvider extends BasePreprocessProvider
// Find the main file after extraction // Find the main file after extraction
let finalPath = '' let finalPath = ''
let finalName = file.origin_name.replace('.pdf', '.md') let finalName = file.origin_name.replace('.pdf', '.md')
// Find the corresponding folder by file name // Find the corresponding folder by file id
outputPath = path.join(outputPath, `${file.origin_name.replace('.pdf', '')}`) outputPath = path.join(outputPath, file.id)
try { try {
const files = fs.readdirSync(outputPath) const files = fs.readdirSync(outputPath)
@ -125,7 +125,7 @@ export default class OpenMineruPreprocessProvider extends BasePreprocessProvider
formData.append('return_md', 'true') formData.append('return_md', 'true')
formData.append('response_format_zip', 'true') formData.append('response_format_zip', 'true')
formData.append('files', fileBuffer, { formData.append('files', fileBuffer, {
filename: file.origin_name filename: file.name
}) })
while (retries < maxRetries) { while (retries < maxRetries) {