#2393·cryptpad

Document: "Insert Spreadsheet" (embedded spreadsheet object) is silently dropped on Save & Exit

Author: Edzilla2000Created Sep 25, 2026Updated Sep 29, 2026
LabelsBugDocumentOnlyOffice

Description

In the Document app, Insert → Table → Insert Spreadsheet opens the spreadsheet editor, but clicking "Save & Exit" inserts nothing into the document. No error is shown.

The cause is the imgurls handler in www/common/onlyoffice/inner.js, which answers OnlyOffice's request for the object's preview image (a data:image/png URL) in two ways that fail:

  1. It calls Util.fetch() on the data: URL. The sandbox CSP (connect-src 'self' blob: <main> <sandbox> …, from lib/defaults.js and the example nginx config) does not allow data:, so the fetch is blocked and the error is swallowed (if (err) { return; }).
  2. Even when the fetch succeeds (tested by adding data: to connect-src), the handler pushes a bare URL.createObjectURL(blob) string into urls. The other branch pushes {path, url} objects, and OnlyOffice's addTableOleObject / editTableOleObject require that shape: if (data[0] && data[0].path != null && data[0].url !== "error"). So the object is still dropped silently.
  3. After fixing the shape, a blob: URL created in the outer frame (main origin) can't be loaded by the editor running on the sandbox origin (CSP default-src block on blob:<main-origin>/…). The preview stays blank until the page is reloaded.

Reproduced on a production deployment (separate HTTPS main and sandbox domains, official Docker image cryptpad/cryptpad:version-2026.5.1, OnlyOffice v9 installed with CPAD_INSTALL_ONLYOFFICE=yes) and on a local instance. It is not specific to localhost or HTTP.

Steps to reproduce

  1. Create a new Document (OnlyOffice-based).
  2. Insert → Table → Insert Spreadsheet.
  3. Enter a few values (e.g. 20, 10, 2 in A1:A3) and a formula (=SUM(A1:A3)).
  4. Click "Save & Exit".

Relevant logs

bash
Content-Security-Policy: The page's settings blocked the loading of a resource (connect-src) at data:image/png;base64,iVBORw0KGgoAAAANSU… because it violates the following directive: "connect-src 'self' blob: <main-origin> <sandbox-origin> <ws-origin>" common-util.js:473:17

Expected behavior

The spreadsheet object is inserted into the document at the cursor, shows its visible range, and can be edited again by double-clicking, as in OnlyOffice Docs.

Suggested fix (tested)

Reply with the data: URL itself, in the {path, url} shape OnlyOffice expects. That avoids both the blocked fetch and the cross-origin blob URL. img-src already allows data:. The change applies to both imgurls handlers in inner.js:

diff
                                 if (/^data\:image/.test(name)) {
-                                    Util.fetch(name, waitFor(function (err, u8) {
-                                        if (err) { return; }
-                                        var b = new Blob([u8]);
-                                        urls.push(URL.createObjectURL(b));
-                                    }));
+                                    urls.push({ path: name, url: name });
                                     return;
                                 }

With this change, the embedded spreadsheet is inserted and rendered immediately, and it is still there after a reload. We have not assessed whether you would prefer to store the preview as an encrypted blob, as for uploaded images.

Which operating system are you using?

Linux/BSD/UNIX (Linux Mint), Microsoft Windows (Windows Server 2022)

What browsers are you seeing the problem on?

Mozilla Firefox

Extensions

Reproduced both with one content-script extension installed and in a browser profile with no extensions.

Version

2026.5.1