Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@

#[RestrictToWopiServer]
class WopiController extends Controller {
// Signifies LOOL that document has been changed externally in this storage
public const LOOL_STATUS_DOC_CHANGED = 1010;
// Signifies COOL that document has been changed externally in this storage
public const COOL_STATUS_DOC_CHANGED = 1010;

public const WOPI_AVATAR_SIZE = 64;

Expand Down Expand Up @@ -586,15 +586,15 @@ public function putFile(string $fileId, string $access_token): JSONResponse {
$file = $this->rootFolder->get($path);
} else {
$file = $this->getFileForWopiToken($wopi);
$wopiHeaderTime = $this->request->getHeader('X-LOOL-WOPI-Timestamp');
$wopiHeaderTime = $this->request->getHeader('X-COOL-WOPI-Timestamp');

if (!empty($wopiHeaderTime) && $wopiHeaderTime !== Helper::toISO8601($file->getMTime() ?? 0)) {
$this->logger->debug('Document timestamp mismatch ! WOPI client says mtime {headerTime} but storage says {storageTime}', [
'headerTime' => $wopiHeaderTime,
'storageTime' => Helper::toISO8601($file->getMTime() ?? 0)
]);
// Tell WOPI client about this conflict.
return new JSONResponse(['LOOLStatusCode' => self::LOOL_STATUS_DOC_CHANGED], Http::STATUS_CONFLICT);
return new JSONResponse(['COOLStatusCode' => self::COOL_STATUS_DOC_CHANGED], Http::STATUS_CONFLICT);
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/features/bootstrap/WopiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function collaboraPuts($source) {
$options = [
'body' => $file,
'headers' => [
'X-LOOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime']
'X-COOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime']
]
];
try {
Expand Down Expand Up @@ -287,7 +287,7 @@ public function collaboraSavesTheFileAs($source, $newName) {
$options = [
'body' => $file,
'headers' => [
'X-LOOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime'],
'X-COOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime'],
'X-WOPI-SuggestedTarget' => $newName,
'X-WOPI-Override' => 'PUT_RELATIVE',
]
Expand All @@ -303,7 +303,7 @@ public function collaboraRenamesTo($fileId, $newName) {
$client = new Client();
$options = [
'headers' => [
'X-LOOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime'],
'X-COOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime'],
'X-WOPI-RequestedName' => $newName,
'X-WOPI-Override' => 'RENAME_FILE',
],
Expand Down
Loading