mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03: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]);
|
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()) {
|
if (self.hasAttachment()) {
|
||||||
result += '&attachment';
|
result += '&attachment';
|
||||||
|
|
|
||||||
|
|
@ -185,17 +185,23 @@ abstract class SearchCriterias
|
||||||
if (\is_string($sRawValue) && '' === \trim($sRawValue)) {
|
if (\is_string($sRawValue) && '' === \trim($sRawValue)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$sValue = static::escapeSearchString($oImapClient, $sRawValue);
|
|
||||||
switch ($sName) {
|
switch ($sName) {
|
||||||
case 'FROM':
|
case 'FROM':
|
||||||
case 'SUBJECT':
|
case 'SUBJECT':
|
||||||
case 'BODY': // $sValue = \trim(\MailSo\Base\Utils::StripSpaces($sValue), '"');
|
case 'BODY': // $sValue = \trim(\MailSo\Base\Utils::StripSpaces($sValue), '"');
|
||||||
|
$aCriteriasResult[] = $sName;
|
||||||
|
$aCriteriasResult[] = static::escapeSearchString($oImapClient, $sRawValue);
|
||||||
|
break;
|
||||||
case 'KEYWORD':
|
case 'KEYWORD':
|
||||||
$aCriteriasResult[] = $sName;
|
$aCriteriasResult[] = $sName;
|
||||||
$aCriteriasResult[] = $sValue;
|
$aCriteriasResult[] = static::escapeSearchString(
|
||||||
|
$oImapClient,
|
||||||
|
\MailSo\Base\Utils::Utf8ToUtf7Modified($sRawValue)
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TO':
|
case 'TO':
|
||||||
|
$sValue = static::escapeSearchString($oImapClient, $sRawValue);
|
||||||
$aCriteriasResult[] = 'OR';
|
$aCriteriasResult[] = 'OR';
|
||||||
$aCriteriasResult[] = 'TO';
|
$aCriteriasResult[] = 'TO';
|
||||||
$aCriteriasResult[] = $sValue;
|
$aCriteriasResult[] = $sValue;
|
||||||
|
|
@ -293,7 +299,7 @@ abstract class SearchCriterias
|
||||||
return $sCriteriasResult ?: 'ALL';
|
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)
|
return !\MailSo\Base\Utils::IsAscii($sSearch)
|
||||||
? '{'.\strlen($sSearch).'}'."\r\n".$sSearch : $oImapClient->EscapeString($sSearch);
|
? '{'.\strlen($sSearch).'}'."\r\n".$sSearch : $oImapClient->EscapeString($sSearch);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue