Improve getFoldersFromResult fix

This commit is contained in:
RainLoop Team 2021-05-05 23:46:51 +03:00
parent 86e62d90ea
commit 46c3e305d7
2 changed files with 64 additions and 36 deletions

View file

@ -1,75 +1,75 @@
#!make
rebuild: _down
docker-compose build --no-cache
docker compose build --no-cache
up: _up status
_up:
docker-compose up -d
docker compose up -d
stop: _stop status
_stop:
docker-compose stop
docker compose stop
down: _down status
_down:
docker-compose down
docker compose down
restart: _stop _up status
status:
@docker-compose ps
@docker compose ps
tx:
@docker-compose run --no-deps --rm tx tx pull -a -s -f -d
@docker compose run --no-deps --rm tx tx pull -a -s -f -d
console-node:
@docker-compose run --no-deps --rm node sh
@docker compose run --no-deps --rm node sh
console-tx:
@docker-compose run --no-deps --rm tx sh
@docker compose run --no-deps --rm tx sh
console-php:
@docker-compose exec php sh
@docker compose exec php sh
console: console-node
logs:
@docker-compose logs --tail=100 -f
@docker compose logs --tail=100 -f
logs-db:
@docker-compose logs --tail=100 -f db
@docker compose logs --tail=100 -f db
logs-php:
@docker-compose logs --tail=100 -f php
@docker compose logs --tail=100 -f php
logs-node:
@docker-compose logs --tail=100 -f node
@docker compose logs --tail=100 -f node
logs-nginx:
@docker-compose logs --tail=100 -f nginx
@docker compose logs --tail=100 -f nginx
logs-mail:
@docker-compose logs --tail=100 -f mail
@docker compose logs --tail=100 -f mail
logs-tx:
@docker-compose logs --tail=100 -f tx
@docker compose logs --tail=100 -f tx
rl-lint:
@docker-compose run --no-deps --rm node gulp lint
@docker compose run --no-deps --rm node gulp lint
rl-dev:
@docker-compose run --no-deps --rm node npm run watch-js
@docker compose run --no-deps --rm node npm run watch-js
rl-compile:
@docker-compose run --no-deps --rm node gulp build
@docker compose run --no-deps --rm node gulp build
rl-compile-with-source:
@docker-compose run --no-deps --rm node gulp build --source
@docker compose run --no-deps --rm node gulp build --source
rl-watch-css:
@docker-compose run --no-deps --rm node npm run watch-css
@docker compose run --no-deps --rm node npm run watch-css
rl-watch-js:
@docker-compose run --no-deps --rm node npm run watch-js
@docker compose run --no-deps --rm node npm run watch-js
rl-build:
@docker-compose run --no-deps --rm node gulp all
@docker compose run --no-deps --rm node gulp all
rl-build-pro:
@docker-compose run --no-deps --rm node gulp all --pro
@docker compose run --no-deps --rm node gulp all --pro
yarn-install:
@docker-compose run --no-deps --rm node yarn install
@docker compose run --no-deps --rm node yarn install
yarn-outdated:
@docker-compose run --no-deps --rm node yarn outdated
@docker compose run --no-deps --rm node yarn outdated
yarn-upgrade:
@docker-compose run --no-deps --rm node yarn upgrade-interactive --exact --latest
@docker compose run --no-deps --rm node yarn upgrade-interactive --exact --latest
gpg:
docker run -it --rm -w=/var/www \

View file

@ -646,6 +646,36 @@ class ImapClient extends \MailSo\Net\NetClient
return $aResult;
}
/**
* @param array|string $mName
*
* @return string
*/
private function getArrayNameToStringName($mName)
{
if (\is_string($mName))
{
return $mName;
}
if (\is_array($mName))
{
if (0 === \count($mName))
{
return '[]';
}
foreach ($mName as &$mSubName)
{
$mSubName = "[{$this->getArrayNameToStringName($mSubName)}]";
}
return \implode('', $mName);
}
return '';
}
/**
* @param array $aResult
* @param string $sStatus
@ -670,20 +700,18 @@ class ImapClient extends \MailSo\Net\NetClient
{
/**
* A bug in the parser converts folder names that start with '[' into arrays,
* and subfolders are in $oResponse->ResponseList[5+]
* and subfolders are in $oImapResponse->ResponseList[5+]
* https://github.com/the-djmaze/snappymail/issues/1
* https://github.com/the-djmaze/snappymail/issues/70
* https://github.com/RainLoop/rainloop-webmail/issues/2037
*/
$sFullNameRaw = \array_slice($oImapResponse->ResponseList, 4);
foreach ($sFullNameRaw as &$name) {
if (\is_array($name)) {
$name = "[{$name[0]}]";
} else if (!\is_string($name)) {
$name = '';
}
$aFullNameRawList = \array_slice($oImapResponse->ResponseList, 4);
foreach ($aFullNameRawList as &$sName)
{
$sName = $this->getArrayNameToStringName($sName);
}
$sFullNameRaw = \implode('', $sFullNameRaw);
$sFullNameRaw = \implode('', $aFullNameRawList);
$oFolder = Folder::NewInstance($sFullNameRaw,
$oImapResponse->ResponseList[3], $oImapResponse->ResponseList[2]);