【问题标题】:Collabora/Code docker install not loading document, throwing JavaScript errorCollabora/Code docker install 未加载文档,抛出 JavaScript 错误
【发布时间】:2021-10-13 11:43:58
【问题描述】:

我已下载并使用以下内容运行 Collabora/Code docker 映像:

    docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=localhost" -e "username=admin" -e "password=S3cRet" -e --restart always collabora/code

我还创建了一个本地 WOPI API,它公开了 4 个必需的端点,我可以在浏览器/邮递员/等中成功地点击这些端点。每当我尝试使用指定的文档访问 Collabora 时,都会收到以下错误:

网址:http://localhost:9980/loleaflet/7151e02/loleaflet.html?WOPISrc=http://localhost:5001/wopi/files/test123

    VM682:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
        at JSON.parse (<anonymous>)
        at PostMessageReadyListener (loleaflet.html?WOPISrc=http://localhost:5001/wopi/files/test:23)

在开发工具中查看该代码显示它在 JSON.parse() 行上失败。 e.data 对象不是字符串,它也不包含 MessageId 属性。

      window.WOPIpostMessageReady = false;
      var PostMessageReadyListener = function(e) {
        if (!(e && e.data))
            return;
        var msg = JSON.parse(e.data);
        if (msg.MessageId === 'Host_PostmessageReady') {
          window.WOPIPostmessageReady = true;
          window.removeEventListener('message', PostMessageReadyListener, false);
        }
      };

这是 Collabora 的问题吗?我没有正确配置的东西?

【问题讨论】:

  • 你找到解决办法了吗?

标签: nextcloud


【解决方案1】:

就我而言,您所写的 SyntaxError 也确实发生在工作环境中。我的问题是 config/security/wopi/host 中缺少条目,也许您需要添加

<host desc="allow localhost." allow="true">localhost</host>

【讨论】:

  • 我厌倦了这个直到同样的错误!
猜你喜欢
  • 2016-01-05
  • 2016-11-03
  • 2016-12-14
  • 2021-12-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多