Mail: Wrong redirect address (for links on the same host?)

Created on 30 Oct 2019  Â·  2Comments  Â·  Source: nextcloud/mail

Server configuration

Web server: Nginx
PHP version: 7.3
Nextcloud Version: 16.0.5
Mail app version: 0.17.0

Two domains on the same host:

  • cloud.domain1.de
  • mail.domain2.de

Expected behavior

Original link in mail:
<a href="https://mail.domain2.de/some/dir/">Description</a>

Should be proxy-transformed to:
<a href="https://cloud.domain1.de/apps/mail/redirect?src=https%3A%2F%2Fmail.domain2.de%2Fsome%2Fdir%2F" target="_blank" rel="noopener noreferrer">Description</a>

Actual behavior

Instead the link clicked ist:
https://cloud.domain1.de/apps/mail/redirect?src=https%3A%2F%2Fcloud.domain1.de%2Fmail.domain2.de%2Fsome%2Fdir%2F
( _https://cloud.domain1.de/mail.domain2.de/some/dir/_ )

Guess:

I just skimmed the code.
Because both domains are on the same host this isnt working as intended:

mail/lib/Service/HtmlPurify/TransformURLScheme.php
$uri = new \HTMLPurifier_URI( $this->request->getServerProtocol(), null, $this->request->getServerHost(), null, $this->urlGenerator->linkToRoute('mail.proxy.redirect'), 'src=' . $originalURL, null); return $uri;

bug invalid

All 2 comments

Because both domains are on the same host this isnt working as intended:

Yep, I suspect the same.

I found the mistake.

Instead of https:// the link started with https:/// (3x/).

Didnt see that. Embarrassing.
Also Firefox simply replaced the /// with // when opened with other mailprograms.

closed, sorry

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MariusBluem picture MariusBluem  Â·  3Comments

jancborchardt picture jancborchardt  Â·  5Comments

benks-io picture benks-io  Â·  4Comments

fsedarkalex picture fsedarkalex  Â·  5Comments

Quix0r picture Quix0r  Â·  5Comments