Skip to content

Several bug fixes: Nextcloud 34, settings XSS escaping, editor lists, Show images, IMAP reconnect, reading pane focus - #2134

Open
jmrapin wants to merge 10 commits into
the-djmaze:masterfrom
jmrapin:upstream-fixes
Open

jmrapin wants to merge 10 commits into
the-djmaze:masterfrom
jmrapin:upstream-fixes

Conversation

@jmrapin

@jmrapin jmrapin commented Nov 19, 2026 •

Copy link
Copy Markdown

One commit per fix, each self-contained:

  1. Nextcloud personal settings: escape email/password (security). templates/personal_settings.php printed both into value="…" unescaped; a quote could break out of the attribute and inject markup.
  2. Nextcloud 34: app manager via the container. \OC::$server->getAppManager() no longer exists on NC 34, so the oidc_login check in SnappyMailHelper failed.
  3. Nextcloud plugin: files work again. \OCP\Files::getStorage() was removed (NC 34 only has rmdirr()), which broke Attach from Nextcloud, Save .eml and Save attachments to Nextcloud. Uses the user folder through a small adapter; older Nextcloud keeps getStorage().
  4. Nextcloud contacts suggestions: catch Throwable, so a PHP Error during the lookup returns no suggestions instead of failing the request.
  5. squire2: INPUT and IFRAME are inline, as in squire-rte 2.3.2. Selection bookmarks are <input>s, so lists, quote and indent skipped the first and last selected lines.
  6. Show images: the CSS background loop tested the leftover src of the <img> loop instead of its own url; cid: urls (inline attachments) are no longer treated as external images.
  7. NetClient: Connect() with a socket already open kept the old connection even for a different host/port/type/user; it now reconnects unless it is the same connection.
  8. Message view: a click in the reading pane gives it keyboard focus (preview pane on), so arrow keys, PgUp/PgDn and Space scroll the message instead of moving the list selection.
  9. Message links from search results or later pages: the Message route read the page from the search group and the search from a group that doesn't exist, so opening a message from a search or page > 1 reloaded page 1 without the search and the message didn't open. Page and search are now separate groups.
  10. Folders with spaces or accents in their name: fullNameHash only encodes # ~ / and hasher decodes the hash, but the Search/Message/Page routes only accepted [a-zA-Z0-9.~_-] as folder, so in folders like "Business Development" clicking a message, paging or searching did nothing. The folder part now accepts anything but /.

All found while running SnappyMail 3.x inside Nextcloud 34

templates/personal_settings.php printed the saved SnappyMail email and password into
value="..." unescaped, so a value with a quote could break out of the attribute and
inject markup into the Nextcloud settings page.
\OC::$server->getAppManager() no longer exists on Nextcloud 34 (the old \OC::$server
getters were removed), so the oidc_login check in SnappyMailHelper failed. Use
\OC::$server->get(\OCP\App\IAppManager::class).
…emoved)

Nextcloud 34's \OCP\Files only has rmdirr(), so "Attach from Nextcloud",
"Save .eml to Nextcloud" and "Save attachments to Nextcloud" failed. The
plugin now uses the user folder (IRootFolder::getUserFolder()) through a
small adapter with the old storage methods; older Nextcloud keeps
getStorage().
A PHP Error during the contacts lookup (e.g. a removed Nextcloud API) escaped the
catch and broke the suggestions request instead of returning no suggestions.
Squire's selection bookmarks are <input> elements. Without INPUT in inlineNodeNames
the first and last selected lines become "containers", so making a list, quote or
indent from a selection skipped those lines. Same list as squire-rte 2.3.2.
- The style url() loop tested src, the leftover variable of the <img> loop above (the
  last image's src, or undefined), instead of the url it is about to set, so a
  background was loaded or skipped depending on an unrelated image.
- cid: urls are inline attachments kept in data-x-src for Compose, not external
  images, so Show images no longer turns them into (proxied) external requests.
Connect() while a socket was open only logged SocketAlreadyConnectedException and kept
the old connection, even when the new settings point at another host, port, type or
username (e.g. switching accounts in one request). Only the same connection is kept now;
otherwise the old one is closed first.
With the preview pane on, a click in the open message left the keyboard scope on the
message list, so arrow keys, PageUp/PageDown and Space moved the list selection instead
of scrolling the message. MessageList already does the reverse for its own pane.
… page 1 without the search

The Message route pattern had one optional group for "/p{page}/{search}", but its
normalize_ read the page from that group and the search from a fourth group that does not
exist. So every message link with a search or page > 1 routed to page 1 with an empty
search: onRoute() saw the search change, reloaded the list, and the clicked message did
not open. Page and search are now separate groups, and the search is decoded like the
Search route does.
…cents in their name

fullNameHash only encodes # ~ / and hasher decodes the hash before routing, so a folder
such as "Business Development", "Équipe" or "R&D (old)" reaches the router with those
characters. The Search, Message and Page routes only accepted [a-zA-Z0-9.~_-] in the
folder part, so in such folders clicking a message, paging or searching matched no route
and did nothing (opening the folder itself worked through the Folder route). The folder
part now accepts anything but "/", like the Folder route.
@the-djmaze

Copy link
Copy Markdown
Owner

Great findings. I have to review them carefully due to changes in the current master branch that created conflicts.

@the-djmaze the-djmaze added the bug Something isn't working label Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants