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 #!make
rebuild: _down rebuild: _down
docker-compose build --no-cache docker compose build --no-cache
up: _up status up: _up status
_up: _up:
docker-compose up -d docker compose up -d
stop: _stop status stop: _stop status
_stop: _stop:
docker-compose stop docker compose stop
down: _down status down: _down status
_down: _down:
docker-compose down docker compose down
restart: _stop _up status restart: _stop _up status
status: status:
@docker-compose ps @docker compose ps
tx: 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: console-node:
@docker-compose run --no-deps --rm node sh @docker compose run --no-deps --rm node sh
console-tx: console-tx:
@docker-compose run --no-deps --rm tx sh @docker compose run --no-deps --rm tx sh
console-php: console-php:
@docker-compose exec php sh @docker compose exec php sh
console: console-node console: console-node
logs: logs:
@docker-compose logs --tail=100 -f @docker compose logs --tail=100 -f
logs-db: logs-db:
@docker-compose logs --tail=100 -f db @docker compose logs --tail=100 -f db
logs-php: logs-php:
@docker-compose logs --tail=100 -f php @docker compose logs --tail=100 -f php
logs-node: logs-node:
@docker-compose logs --tail=100 -f node @docker compose logs --tail=100 -f node
logs-nginx: logs-nginx:
@docker-compose logs --tail=100 -f nginx @docker compose logs --tail=100 -f nginx
logs-mail: logs-mail:
@docker-compose logs --tail=100 -f mail @docker compose logs --tail=100 -f mail
logs-tx: logs-tx:
@docker-compose logs --tail=100 -f tx @docker compose logs --tail=100 -f tx
rl-lint: rl-lint:
@docker-compose run --no-deps --rm node gulp lint @docker compose run --no-deps --rm node gulp lint
rl-dev: 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: rl-compile:
@docker-compose run --no-deps --rm node gulp build @docker compose run --no-deps --rm node gulp build
rl-compile-with-source: 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: 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: 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: rl-build:
@docker-compose run --no-deps --rm node gulp all @docker compose run --no-deps --rm node gulp all
rl-build-pro: 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: yarn-install:
@docker-compose run --no-deps --rm node yarn install @docker compose run --no-deps --rm node yarn install
yarn-outdated: yarn-outdated:
@docker-compose run --no-deps --rm node yarn outdated @docker compose run --no-deps --rm node yarn outdated
yarn-upgrade: 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: gpg:
docker run -it --rm -w=/var/www \ docker run -it --rm -w=/var/www \

View file

@ -646,6 +646,36 @@ class ImapClient extends \MailSo\Net\NetClient
return $aResult; 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 array $aResult
* @param string $sStatus * @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, * 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/1
* https://github.com/the-djmaze/snappymail/issues/70 * https://github.com/the-djmaze/snappymail/issues/70
* https://github.com/RainLoop/rainloop-webmail/issues/2037 * https://github.com/RainLoop/rainloop-webmail/issues/2037
*/ */
$sFullNameRaw = \array_slice($oImapResponse->ResponseList, 4); $aFullNameRawList = \array_slice($oImapResponse->ResponseList, 4);
foreach ($sFullNameRaw as &$name) { foreach ($aFullNameRawList as &$sName)
if (\is_array($name)) { {
$name = "[{$name[0]}]"; $sName = $this->getArrayNameToStringName($sName);
} else if (!\is_string($name)) {
$name = '';
}
} }
$sFullNameRaw = \implode('', $sFullNameRaw);
$sFullNameRaw = \implode('', $aFullNameRawList);
$oFolder = Folder::NewInstance($sFullNameRaw, $oFolder = Folder::NewInstance($sFullNameRaw,
$oImapResponse->ResponseList[3], $oImapResponse->ResponseList[2]); $oImapResponse->ResponseList[3], $oImapResponse->ResponseList[2]);