mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 04:22:15 +08:00
Encode KEYWORD search for #419
This commit is contained in:
parent
ba19d4e6b1
commit
df2de7ad66
2 changed files with 10 additions and 4 deletions
|
@ -107,7 +107,7 @@ export class AdvancedSearchPopupView extends AbstractViewPopup {
|
|||
append('since', d.toISOString().split('T')[0]);
|
||||
}
|
||||
|
||||
let result = new URLSearchParams(data).toString().replace('%24','$');
|
||||
let result = decodeURIComponent(new URLSearchParams(data).toString());
|
||||
|
||||
if (self.hasAttachment()) {
|
||||
result += '&attachment';
|
||||
|
|
|
@ -185,17 +185,23 @@ abstract class SearchCriterias
|
|||
if (\is_string($sRawValue) && '' === \trim($sRawValue)) {
|
||||
continue;
|
||||
}
|
||||
$sValue = static::escapeSearchString($oImapClient, $sRawValue);
|
||||
switch ($sName) {
|
||||
case 'FROM':
|
||||
case 'SUBJECT':
|
||||
case 'BODY': // $sValue = \trim(\MailSo\Base\Utils::StripSpaces($sValue), '"');
|
||||
$aCriteriasResult[] = $sName;
|
||||
$aCriteriasResult[] = static::escapeSearchString($oImapClient, $sRawValue);
|
||||
break;
|
||||
case 'KEYWORD':
|
||||
$aCriteriasResult[] = $sName;
|
||||
$aCriteriasResult[] = $sValue;
|
||||
$aCriteriasResult[] = static::escapeSearchString(
|
||||
$oImapClient,
|
||||
\MailSo\Base\Utils::Utf8ToUtf7Modified($sRawValue)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'TO':
|
||||
$sValue = static::escapeSearchString($oImapClient, $sRawValue);
|
||||
$aCriteriasResult[] = 'OR';
|
||||
$aCriteriasResult[] = 'TO';
|
||||
$aCriteriasResult[] = $sValue;
|
||||
|
@ -293,7 +299,7 @@ abstract class SearchCriterias
|
|||
return $sCriteriasResult ?: 'ALL';
|
||||
}
|
||||
|
||||
public static function escapeSearchString(\MailSo\Imap\ImapClient $oImapClient, string $sSearch) : string
|
||||
private static function escapeSearchString(\MailSo\Imap\ImapClient $oImapClient, string $sSearch) : string
|
||||
{
|
||||
return !\MailSo\Base\Utils::IsAscii($sSearch)
|
||||
? '{'.\strlen($sSearch).'}'."\r\n".$sSearch : $oImapClient->EscapeString($sSearch);
|
||||
|
|
Loading…
Reference in a new issue