summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBennet Becker <dev@bennet.cc>2022-12-23 21:48:52 +0100
committerBennet Becker <dev@bennet.cc>2022-12-23 21:48:52 +0100
commit411467af57cf94eb2ee6a90538017640a76d0dcb (patch)
tree89b3e3a4f8313516c577b3d8f6438895c805408d /lib
parent4b992cdf7f2b1b5fa998cca7949a821122dd582f (diff)
downloadnextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.tar.gz
nextcloud-server-411467af57cf94eb2ee6a90538017640a76d0dcb.zip
fix static-analysis error and formatting code
Signed-off-by: Bennet Becker <dev@bennet.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Mail/Message.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index d074befcae4..417b64d0f3a 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -307,18 +307,23 @@ class Message implements IMessage {
* Add the Auto-Submitted header to the email, preventing most automated
* responses to automated messages.
*
- * @param string $value (one of AutoSubmittedValue::NO, AutoSubmittedValue::AUTO_GENERATED, AutoSubmittedValue::AUTO_REPLIED)
+ * @param AutoSubmittedValue::* $value (one of AutoSubmittedValue::NO, AutoSubmittedValue::AUTO_GENERATED, AutoSubmittedValue::AUTO_REPLIED)
* @return $this
*/
public function setAutoSubmitted(string $value): IMessage {
$headers = $this->swiftMessage->getHeaders();
- if($headers->has('Auto-Submitted')) {
- $auto_submitted = $headers->get('Auto-Submitted');
- $auto_submitted->setValue($value);
- } else {
- $headers->addTextHeader('Auto-Submitted', $value);
+
+ if ($headers->has('Auto-Submitted')) {
+ // if the header already exsists, remove it.
+ // the value can be modified with some implementations
+ // of the interface \Swift_Mime_Header, however the
+ // interface doesn't, and this makes the static-code
+ // analysis unhappy.
+ $headers->remove('Auto-Submitted');
}
+ $headers->addTextHeader('Auto-Submitted', $value);
+
return $this;
}