mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
Update parseOffice.ts (#3901)
更新本地导入pptx文件提示文件编码错误 The argument 'windows-1252' is invalid encoding. Received 'encoding'
This commit is contained in:
@@ -46,11 +46,9 @@ const parsePowerPoint = async ({
|
|||||||
// Returning an array of all the xml contents read using fs.readFileSync
|
// Returning an array of all the xml contents read using fs.readFileSync
|
||||||
const xmlContentArray = await Promise.all(
|
const xmlContentArray = await Promise.all(
|
||||||
files.map((file) => {
|
files.map((file) => {
|
||||||
try {
|
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding).catch(() => {
|
||||||
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding);
|
|
||||||
} catch (err) {
|
|
||||||
return fs.promises.readFile(`${decompressPath}/${file.path}`, 'utf-8');
|
return fs.promises.readFile(`${decompressPath}/${file.path}`, 'utf-8');
|
||||||
}
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user