Skip to content

Commit 27ebd2e

Browse files
authored
Update parseOffice.ts (#3901)
更新本地导入pptx文件提示文件编码错误 The argument 'windows-1252' is invalid encoding. Received 'encoding'
1 parent 81a0671 commit 27ebd2e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/service/worker/readFile/parseOffice.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ const parsePowerPoint = async ({
4646
// Returning an array of all the xml contents read using fs.readFileSync
4747
const xmlContentArray = await Promise.all(
4848
files.map((file) => {
49-
try {
50-
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding);
51-
} catch (err) {
49+
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding).catch(() => {
5250
return fs.promises.readFile(`${decompressPath}/${file.path}`, 'utf-8');
53-
}
51+
});
5452
})
5553
);
5654

0 commit comments

Comments
 (0)