Open Simon-Laux opened 1 month ago
@Simon-Laux Thank you so much for the details :)
Okay after investigating, other than Simon's findings, I can also confirm that it's not http
, https
, file
or email
protocols either.
This does not trigger either when clicking on the link: https://www.electronjs.org/docs/latest/api/web-contents#event-will-frame-navigate
More specifically, links without a schema, like
academy.qt.io/enrollments
Expected: Open link in system browser Actual: Opening opens a blank page in the html viewer.
Tracking down the problem & Solution ideas
Foundation knowledge
The html email window has two parts: the ui and a sandboxed browser view with disable JS in which the html email is loaded.
Email source is loaded from the
email://
scheme that is implemented in https://github.com/deltachat/deltachat-desktop/blob/ba6534b3a9d60ad3e602f770ba630849cc62b87c/src/main/windows/html_email.ts#L412-L420The http/s handlers are overwritten by handlers that call the http request method of DC core, if
allow_remote_content
is activated.Then there is link handling:
https://github.com/deltachat/deltachat-desktop/blob/ba6534b3a9d60ad3e602f770ba630849cc62b87c/src/main/windows/html_email.ts#L472-L493
This
openLink
function is called in two cases:sandboxedView.webContents.on( 'will-navigate', ...
sourcesandboxedView.webContents.setWindowOpenHandler(details => { ...
sourceseems this is not enough to catch this case. I suspect it tries to open it via the
email://
scheme, so we might need to check if it is a domain that is tried to be opened instead of index.html.concerns:
<a href=
links, to addhttps
-scheme, but not sure we want that, could lead to more edge cases/bugs.If you want or need dev tools for the email content add this to the code in
html_email.ts
.