Skip to content

Commit 910cbc5

Browse files
committed
fix: widen owner_uid and editor_uid columns to support federated cloud IDs
When a federated cloud ID exceeds 64 characters, the owner_uid and editor_uid columns in oc_richdocuments_wopi silently truncate the value, which can prevent federated users from opening documents in Collabora. Widen both columns from varchar(64) to varchar(255) to accommodate the full length of federated cloud IDs in the format user@remote.domain. Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
1 parent d8e0019 commit 910cbc5

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Richdocuments\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
use Override;
17+
18+
/**
19+
* Widen owner_uid and editor_uid columns from varchar(64) to varchar(255) to support federated cloud IDs
20+
*/
21+
class Version10100Date20260226000000 extends SimpleMigrationStep {
22+
#[Override]
23+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
24+
/** @var ISchemaWrapper $schema */
25+
$schema = $schemaClosure();
26+
$changed = false;
27+
28+
if ($schema->hasTable('richdocuments_wopi')) {
29+
$table = $schema->getTable('richdocuments_wopi');
30+
foreach (['owner_uid', 'editor_uid'] as $columnName) {
31+
if ($table->hasColumn($columnName) && $table->getColumn($columnName)->getLength() < 255) {
32+
$table->changeColumn($columnName, [
33+
'length' => 255,
34+
]);
35+
$changed = true;
36+
}
37+
}
38+
}
39+
40+
return $changed ? $schema : null;
41+
}
42+
}

0 commit comments

Comments
 (0)