Skip to content

Commit de5714a

Browse files
committed
allow disabling object store write check
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 9475cc0 commit de5714a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/private/Files/ObjectStore/ObjectStoreStorage.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
6161

6262
private $logger;
6363

64+
/** @var bool */
65+
protected $validateWrites = true;
66+
6467
public function __construct($params) {
6568
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
6669
$this->objectStore = $params['objectstore'];
@@ -75,6 +78,9 @@ public function __construct($params) {
7578
if (isset($params['objectPrefix'])) {
7679
$this->objectPrefix = $params['objectPrefix'];
7780
}
81+
if (isset($params['validateWrites'])) {
82+
$this->validateWrites = (bool)$params['validateWrites'];
83+
}
7884
//initialize cache with root directory in cache
7985
if (!$this->is_dir('/')) {
8086
$this->mkdir('/');
@@ -522,7 +528,7 @@ public function writeStream(string $path, $stream, int $size = null): int {
522528
if ($exists) {
523529
$this->getCache()->update($fileId, $stat);
524530
} else {
525-
if ($this->objectStore->objectExists($urn)) {
531+
if (!$this->validateWrites || $this->objectStore->objectExists($urn)) {
526532
$this->getCache()->move($uploadPath, $path);
527533
} else {
528534
$this->getCache()->remove($uploadPath);

0 commit comments

Comments
 (0)