diff --git a/build/nextcloud.php b/build/nextcloud.php index fa50e1993..10f2595eb 100755 --- a/build/nextcloud.php +++ b/build/nextcloud.php @@ -17,6 +17,7 @@ foreach ($files as $file) { if (is_file($file)) { $name = str_replace('\\', '/', $file); $name = str_replace('integrations/nextcloud/snappymail/', '', $name); + $name = str_replace('.htaccess', '_htaccess', $name); $hashes[$name] = hash_file('sha512', $file); } } @@ -36,7 +37,7 @@ $nc_tar->addFromString('data/VERSION', $package->version); $nc_tar->addFile('data/README.md'); $nc_tar->addFile('_include.php', 'snappymail/app/_include.php'); */ -$nc_tar->addFile('.htaccess', 'snappymail/app/.htaccess'); +$nc_tar->addFile('.htaccess', 'snappymail/app/_htaccess'); $hashes['app/.htaccess'] = hash_file('sha512', '.htaccess'); $index = file_get_contents('index.php'); diff --git a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php index 4ad07f660..c66b65610 100644 --- a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php +++ b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php @@ -27,7 +27,19 @@ class SnappyMailHelper // include APP_INDEX_ROOT_PATH.'snappymail/v/'.APP_VERSION.'/include.php'; // define('APP_DATA_FOLDER_PATH', \rtrim(\trim(\OC::$server->getSystemConfig()->getValue('datadirectory', '')), '\\/').'/appdata_snappymail/'); - require_once \dirname(\dirname(__DIR__)) . '/app/index.php'; + $app_dir = \dirname(\dirname(__DIR__)) . '/app'; + require_once $app_dir . '/index.php'; + + // https://github.com/the-djmaze/snappymail/issues/790#issuecomment-1366527884 + if (!file_exists($app_dir . '/.htaccess') && file_exists($app_dir . '/_htaccess')) { + rename($app_dir . '/_htaccess', $app_dir . '/.htaccess'); + if (!file_exists(APP_VERSION_ROOT_PATH . '/app/.htaccess') && file_exists(APP_VERSION_ROOT_PATH . '/app/_htaccess')) { + rename(APP_VERSION_ROOT_PATH . '/app/_htaccess', APP_VERSION_ROOT_PATH . '/app/.htaccess'); + } + if (!file_exists(APP_VERSION_ROOT_PATH . '/static/.htaccess') && file_exists(APP_VERSION_ROOT_PATH . '/static/_htaccess')) { + rename(APP_VERSION_ROOT_PATH . '/static/_htaccess', APP_VERSION_ROOT_PATH . '/static/.htaccess'); + } + } $oConfig = \RainLoop\Api::Config(); $bSave = false;