Fix regression that broke use_secure_urls feature (#9052)

This commit is contained in:
Aleksander Machniak
2023-07-09 11:23:44 +02:00
parent c5022b9e52
commit d2e8a889c4
4 changed files with 10 additions and 2 deletions

View File

@@ -26,6 +26,7 @@
- Fix potential HTTP protocol version mismatch (#8982)
- Fix bug where installto.sh/update.sh scripts were removing some essential options from the config file (#9051)
- Update jQuery-UI to version 1.13.2 (#9041)
- Fix regression that broke use_secure_urls feature (#9052)
## Release 1.6.2

View File

@@ -815,6 +815,7 @@ $config['no_save_sent_messages'] = false;
// Warning: This requires http server configuration. Sample:
// RewriteRule ^/roundcubemail/[a-zA-Z0-9]{16}/(.*) /roundcubemail/$1 [PT]
// Alias /roundcubemail /var/www/roundcubemail/
// Warning: This feature does NOT work with request_path = 'SCRIPT_NAME'
// Note: Use assets_path to not prevent the browser from caching assets
$config['use_secure_urls'] = false;

View File

@@ -1171,7 +1171,7 @@ class rcmail extends rcube
$path = $_SERVER[$path];
}
else if (empty($path)) {
foreach (['REDIRECT_SCRIPT_URL', 'SCRIPT_NAME', 'REQUEST_URI'] as $name) {
foreach (['REQUEST_URI', 'REDIRECT_SCRIPT_URL', 'SCRIPT_NAME'] as $name) {
if (!empty($_SERVER[$name])) {
$path = $_SERVER[$name];
break;

View File

@@ -120,8 +120,14 @@ class rcmail_oauth
*/
public function get_redirect_uri()
{
$url = $this->rcmail->url([], true, true);
// rewrite redirect URL to not contain query parameters because some providers do not support this
return preg_replace('/\/?\?_task=[a-z]+/', '/index.php/login/oauth', $this->rcmail->url([], true, true));
// also make sure to not duplicate the index.php/... path
$url = preg_replace('/\?.*/', '', $url);
$url = preg_replace('/index\.php.*$/', '', $url);
return slashify($url) . 'index.php/login/oauth';
}
/**