Skip to content

Commit 4cb3228

Browse files
authored
Merge pull request #5055 from nextcloud/backport/4366/stable29
[stable29] fix: Apply proper default timezone for watermarks
2 parents 7b3b2f5 + dcc3c4c commit 4cb3228

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Controller/WopiController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,13 @@ public function checkFileInfo($fileId, $access_token) {
206206
$share = $this->getShareForWopiToken($wopi);
207207
if ($this->permissionManager->shouldWatermark($file, $wopi->getEditorUid(), $share)) {
208208
$email = $user !== null && !$isPublic ? $user->getEMailAddress() : "";
209+
$currentDateTime = new \DateTime(
210+
'now',
211+
new \DateTimeZone($this->config->getSystemValueString('default_timezone', 'UTC'))
212+
);
209213
$replacements = [
210214
'userId' => $wopi->getEditorUid(),
211-
'date' => (new \DateTime())->format('Y-m-d H:i:s'),
215+
'date' => $currentDateTime->format('Y-m-d H:i:s'),
212216
'themingName' => \OC::$server->getThemingDefaults()->getName(),
213217
'userDisplayName' => $userDisplayName,
214218
'email' => $email,

0 commit comments

Comments
 (0)