mirror of
https://github.com/nextcloud/server.git
synced 2026-05-13 00:51:10 -04:00
window.Buffer is a Node.js API that is not natively available in browsers. It was apparently polyfilled in the webpack bundle by a dependency, but the polyfill is absent in environments like headless Electron (Cypress). This went undetected because browserslist-useragent-regexp < 4.1.4 had a bug where an empty browser set produced /(?:)/ (matches everything). Electron matched as "supported" and the redirect code was never reached. browserslist-useragent-regexp 4.1.4 fixed that bug (PR #1583: faithfully match an empty set of browsers), generating /[]/ instead. Electron 118 no longer matches as supported, the redirect path is now exercised, and window.Buffer.from() throws: TypeError: Cannot read properties of undefined (reading 'from') The fix replaces window.Buffer.from(str).toString('base64') with the native browser btoa(str), which has been universally available since before our minimum browser support baseline and requires no polyfill. Fixes: #57920 Signed-off-by: Anna Larch <anna@nextcloud.com> |
||
|---|---|---|
| .. | ||
| ClipboardFallback.ts | ||
| RedirectUnsupportedBrowsers.js | ||
| xhr-request.js | ||