Skip to content

Commit 197c1ef

Browse files
committed
fix(sharing): fix potentially broken shares from the past, change 'null' download permission to 'true'
Signed-off-by: Julien Veyssier <[email protected]>
1 parent 52f99e6 commit 197c1ef

File tree

5 files changed

+41
-7
lines changed

5 files changed

+41
-7
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
namespace OC\Core\Migrations;
10+
11+
use OCP\DB\QueryBuilder\IQueryBuilder;
12+
use OCP\IDBConnection;
13+
use OCP\Migration\Attributes\DataCleansing;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
use OCP\Share\IShare;
17+
18+
#[DataCleansing(table: 'share', description: 'Fix share download permissions')]
19+
class Version33000Date20251106131209 extends SimpleMigrationStep {
20+
public function __construct(
21+
private readonly IDBConnection $connection,
22+
) {
23+
}
24+
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
25+
$qb = $this->connection->getQueryBuilder();
26+
$qb->update('share')
27+
->set('attributes', $qb->createNamedParameter('[["permissions","download",true]]'))
28+
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_CIRCLE, IQueryBuilder::PARAM_INT)))
29+
->andWhere($qb->expr()->eq('attributes', $qb->createNamedParameter('[["permissions","download",null]]', IQueryBuilder::PARAM_STR)));
30+
$qb->executeStatement();
31+
}
32+
}

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,7 @@
15321532
'OC\\Core\\Migrations\\Version33000Date20251013110519' => $baseDir . '/core/Migrations/Version33000Date20251013110519.php',
15331533
'OC\\Core\\Migrations\\Version33000Date20251023110529' => $baseDir . '/core/Migrations/Version33000Date20251023110529.php',
15341534
'OC\\Core\\Migrations\\Version33000Date20251023120529' => $baseDir . '/core/Migrations/Version33000Date20251023120529.php',
1535+
'OC\\Core\\Migrations\\Version33000Date20251106131209' => $baseDir . '/core/Migrations/Version33000Date20251106131209.php',
15351536
'OC\\Core\\Notification\\CoreNotifier' => $baseDir . '/core/Notification/CoreNotifier.php',
15361537
'OC\\Core\\ResponseDefinitions' => $baseDir . '/core/ResponseDefinitions.php',
15371538
'OC\\Core\\Service\\CronService' => $baseDir . '/core/Service/CronService.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
15731573
'OC\\Core\\Migrations\\Version33000Date20251013110519' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251013110519.php',
15741574
'OC\\Core\\Migrations\\Version33000Date20251023110529' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251023110529.php',
15751575
'OC\\Core\\Migrations\\Version33000Date20251023120529' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251023120529.php',
1576+
'OC\\Core\\Migrations\\Version33000Date20251106131209' => __DIR__ . '/../../..' . '/core/Migrations/Version33000Date20251106131209.php',
15761577
'OC\\Core\\Notification\\CoreNotifier' => __DIR__ . '/../../..' . '/core/Notification/CoreNotifier.php',
15771578
'OC\\Core\\ResponseDefinitions' => __DIR__ . '/../../..' . '/core/ResponseDefinitions.php',
15781579
'OC\\Core\\Service\\CronService' => __DIR__ . '/../../..' . '/core/Service/CronService.php',

lib/private/Collaboration/Reference/ReferenceManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public function getReferenceFromCache(string $referenceId, bool $public = false,
7676
*/
7777
public function getReferenceByCacheKey(string $cacheKey): ?IReference {
7878
$cached = $this->cache->get($cacheKey);
79-
if ($cached) {
80-
return Reference::fromCache($cached);
81-
}
79+
// if ($cached) {
80+
// return Reference::fromCache($cached);
81+
// }
8282

8383
return null;
8484
}
@@ -96,9 +96,9 @@ public function resolveReference(string $referenceId, bool $public = false, $sha
9696

9797
$cacheKey = $this->getFullCacheKey($matchedProvider, $referenceId, $public, $sharingToken);
9898
$cached = $this->cache->get($cacheKey);
99-
if ($cached) {
100-
return Reference::fromCache($cached);
101-
}
99+
// if ($cached) {
100+
// return Reference::fromCache($cached);
101+
// }
102102

103103
$reference = null;
104104
if ($public && $matchedProvider instanceof IPublicReferenceProvider) {

version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patch level
1010
// when updating major/minor version number.
1111

12-
$OC_Version = [33, 0, 0, 3];
12+
$OC_Version = [33, 0, 0, 4];
1313

1414
// The human-readable string
1515
$OC_VersionString = '33.0.0 dev';

0 commit comments

Comments
 (0)