fix: line ending for sieve scripts should be clrf
Ref https://www.rfc-editor.org/rfc/rfc5228#section-2.2 Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Родитель
3fad97eeee
Коммит
1f54a38748
|
@ -3,3 +3,4 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
/CHANGELOG.md merge=union
|
||||
/vendor-bin/**/composer.lock binary
|
||||
/tests/data/*.sieve text eol=crlf
|
||||
|
|
|
@ -90,7 +90,7 @@ SPDX-FileCopyrightText = "2022 Nextcloud GmbH and Nextcloud contributors"
|
|||
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
||||
|
||||
[[annotations]]
|
||||
path = ["src/tests/data/user@imap.localhost.chain.p12", "src/tests/data/user@imap.localhost.crt", "src/tests/data/user@imap.localhost.key", "src/tests/data/user@imap.localhost.p12", "tests/data/smime-certs/cn-only@imap.localhost.crt", "tests/data/smime-certs/cn-only@imap.localhost.key", "tests/data/smime-certs/imap.localhost.ca.crt", "tests/data/smime-certs/domain.tld.ca.crt", "tests/data/smime-certs/user@domain.tld.crt", "tests/data/smime-certs/user@domain.tld.key", "tests/data/smime-certs/user@imap.localhost.crt", "tests/data/smime-certs/user@imap.localhost.key", "tests/data/decrypted-message-body.txt", "tests/data/decrypted-signed-opaque-message-body.txt", "tests/data/encrypted-message.txt", "tests/data/encrypted-signed-opaque-message.txt", "tests/data/sieve-vacation-cleaned.txt", "tests/data/sieve-vacation-off.txt", "tests/data/sieve-vacation-on-no-end-date.txt", "tests/data/sieve-vacation-on-no-tz.txt", "tests/data/sieve-vacation-on-special-chars-message.txt", "tests/data/sieve-vacation-on-special-chars-subject.txt", "tests/data/sieve-vacation-on-subject-placeholder.txt", "tests/data/sieve-vacation-on.txt", "tests/data/signed-message.txt", "tests/data/signed-opaque-message.txt"]
|
||||
path = ["src/tests/data/user@imap.localhost.chain.p12", "src/tests/data/user@imap.localhost.crt", "src/tests/data/user@imap.localhost.key", "src/tests/data/user@imap.localhost.p12", "tests/data/smime-certs/cn-only@imap.localhost.crt", "tests/data/smime-certs/cn-only@imap.localhost.key", "tests/data/smime-certs/imap.localhost.ca.crt", "tests/data/smime-certs/domain.tld.ca.crt", "tests/data/smime-certs/user@domain.tld.crt", "tests/data/smime-certs/user@domain.tld.key", "tests/data/smime-certs/user@imap.localhost.crt", "tests/data/smime-certs/user@imap.localhost.key", "tests/data/decrypted-message-body.txt", "tests/data/decrypted-signed-opaque-message-body.txt", "tests/data/encrypted-message.txt", "tests/data/encrypted-signed-opaque-message.txt", "tests/data/sieve-vacation-cleaned.sieve", "tests/data/sieve-vacation-off.sieve", "tests/data/sieve-vacation-on-no-end-date.sieve", "tests/data/sieve-vacation-on-no-tz.sieve", "tests/data/sieve-vacation-on-special-chars-message.sieve", "tests/data/sieve-vacation-on-special-chars-subject.sieve", "tests/data/sieve-vacation-on-subject-placeholder.sieve", "tests/data/sieve-vacation-on.sieve", "tests/data/signed-message.txt", "tests/data/signed-opaque-message.txt"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2023 Nextcloud GmbH and Nextcloud contributors"
|
||||
SPDX-License-Identifier = "AGPL-3.0-or-later"
|
||||
|
|
|
@ -73,7 +73,7 @@ class OutOfOfficeParser {
|
|||
$state = $nextState;
|
||||
}
|
||||
|
||||
return new OutOfOfficeParserResult($data, $sieveScript, implode("\n", $scriptOut));
|
||||
return new OutOfOfficeParserResult($data, $sieveScript, implode("\r\n", $scriptOut));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,7 +99,7 @@ class OutOfOfficeParser {
|
|||
|
||||
if (!$state->isEnabled()) {
|
||||
//unset($jsonData['start'], $jsonString['end']);
|
||||
return implode("\n", [
|
||||
return implode("\r\n", [
|
||||
$untouchedScript,
|
||||
self::SEPARATOR,
|
||||
self::DATA_MARKER . $stateJsonString,
|
||||
|
@ -173,7 +173,7 @@ class OutOfOfficeParser {
|
|||
self::SEPARATOR,
|
||||
]);
|
||||
|
||||
return implode("\n", array_merge(
|
||||
return implode("\r\n", array_merge(
|
||||
$requireSection,
|
||||
[$untouchedScript],
|
||||
$vacationSection,
|
||||
|
|
|
@ -24,8 +24,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testParseEnabledResponder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on.txt");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on.sieve");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->parseOutOfOfficeState($script);
|
||||
self::assertEquals($script, $actual->getSieveScript());
|
||||
|
@ -39,8 +39,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testParseDisabledResponder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-off.txt");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-off.sieve");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->parseOutOfOfficeState($script);
|
||||
self::assertEquals($script, $actual->getSieveScript());
|
||||
|
@ -54,7 +54,7 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testParseLeaveForeignScriptUntouched(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->parseOutOfOfficeState($script);
|
||||
self::assertEquals($script, $actual->getSieveScript());
|
||||
|
@ -63,8 +63,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testParseOldEnabledResponder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-no-tz.txt");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-no-tz.sieve");
|
||||
$cleanedScript = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->parseOutOfOfficeState($script);
|
||||
self::assertEquals($script, $actual->getSieveScript());
|
||||
|
@ -78,8 +78,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildEnabledResponder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
@ -96,8 +96,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildEnabledResponderWithoutEndDate(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-no-end-date.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-no-end-date.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
@ -114,8 +114,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildEnabledResponderWithSpecialCharsInMessage(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-special-chars-message.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-special-chars-message.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
@ -123,7 +123,7 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
new DateTimeImmutable("2022-09-02T00:00:00+0100"),
|
||||
null,
|
||||
"On vacation",
|
||||
"I'm on vacation.\n\"Hello, World!\"\n\\ escaped backslash",
|
||||
"I'm on vacation.\r\n\"Hello, World!\"\r\n\\ escaped backslash",
|
||||
),
|
||||
$script,
|
||||
["Test Test <test@test.org>", "Test Alias <alias@test.org>"],
|
||||
|
@ -132,8 +132,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildEnabledResponderWithSpecialCharsInSubject(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-special-chars-subject.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-special-chars-subject.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
@ -150,8 +150,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildEnabledResponderWithSubjectPlaceholder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-subject-placeholder.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-on-subject-placeholder.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
@ -168,8 +168,8 @@ class OutOfOfficeParserTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testBuildDisabledResponder(): void {
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.txt");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-off.txt");
|
||||
$script = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-cleaned.sieve");
|
||||
$expected = file_get_contents(__DIR__ . "/../../../data/sieve-vacation-off.sieve");
|
||||
|
||||
$actual = $this->outOfOfficeParser->buildSieveScript(
|
||||
new OutOfOfficeState(
|
||||
|
|
|
@ -11,7 +11,7 @@ if address "From" "marketing@company.org" {
|
|||
}
|
||||
|
||||
### Nextcloud Mail: Vacation Responder ### DON'T EDIT ###
|
||||
# DATA: {"version":1,"enabled":true,"start":"2022-09-02T00:00:00+01:00","subject":"On vacation","message":"I'm on vacation.\n\"Hello, World!\"\n\\ escaped backslash"}
|
||||
# DATA: {"version":1,"enabled":true,"start":"2022-09-02T00:00:00+01:00","subject":"On vacation","message":"I'm on vacation.\r\n\"Hello, World!\"\r\n\\ escaped backslash"}
|
||||
if currentdate :value "ge" "iso8601" "2022-09-01T23:00:00Z" {
|
||||
vacation :days 4 :subject "On vacation" :addresses ["Test Test <test@test.org>", "Test Alias <alias@test.org>"] "I'm on vacation.
|
||||
\"Hello, World!\"
|
Загрузка…
Ссылка в новой задаче