Etherpad-lite: 导入具有未知(或无)扩展名的文件时出现 UnhandledPromiseRejectionWarning

创建于 2020-03-14  ·  5评论  ·  资料来源: ether/etherpad-lite

这发生在 1.8 中:

[ERROR] console - (node:27731) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
   at makeCallback (fs.js:136:11)
   at Object.rename (fs.js:578:14)
   at doImport (/opt/etherpad-lite/src/node/handler/ImportHandler.js:104:16)
   at process._tickCallback (internal/process/next_tick.js:68:7)

当导入文件名中没有已知扩展名的文件(例如根本没有扩展名)时,会发生这种情况。 作为一种解决方法,您必须设置文件名并让它以扩展名结尾,例如.txt


@muxator编辑:这不仅发生在没有给出扩展名时,而且当allowUnknownFileEnds中的settings.jsontrue时,每个未知扩展名(包括没有)都会发生这种情况。 相应地更改了标题。

ExporImport Minor Bug async-migration

最有用的评论

修复了@tudorconstantin 的#3722 拉入问题。
谢谢大家。

所有5条评论

啊好吧,这是由于异步工作 cc @raybellis

https://github.com/ether/etherpad-lite/blob/develop/src/node/handler/ImportHandler.js#L104

这是违规行,如果您将whatever.md等上传到Etherpad,您将看到此错误。

有没有时间看看@raybellis

对于我的插件开发,我只是绕过它。

https://github.com/ether/etherpad-lite/pull/3718/files是我的hacky 解决方法。 @raybellis

非 hacky 修复是用await fsp_rename(src, dst)替换对fs.rename(src, dst, cb)的调用

啊,我看到@tudorconstantin已经打败了我 :)

修复了@tudorconstantin 的#3722 拉入问题。
谢谢大家。

此页面是否有帮助?
0 / 5 - 0 等级