Compare commits

...

1 Commits

Author SHA1 Message Date
Julius Härtl 8d27561d96 debug: Some code paths for debugging
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-06-20 18:39:01 +02:00
3 changed files with 12 additions and 1 deletions
+6
View File
@@ -22,6 +22,7 @@ use OCP\Files\NotFoundException;
use OCP\IPreview;
use OCP\IRequest;
use OCP\Preview\IMimeIconProvider;
use Psr\Log\LoggerInterface;
class PreviewController extends Controller {
public function __construct(
@@ -141,6 +142,11 @@ class PreviewController extends Controller {
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
if ($node->getId() <= 0) {
\OCP\Server::get(LoggerInterface::class)->error('Requested preview with invalid file id: ' . $node->getId());
return new DataResponse([], Http::STATUS_FORBIDDEN);
}
$storage = $node->getStorage();
if ($storage->instanceOfStorage(SharedStorage::class)) {
/** @var SharedStorage $storage */
@@ -493,7 +493,9 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
$stat['checksum'] = '';
$exists = $this->getCache()->inCache($path);
// if ($this->needsPartFile()) {
$uploadPath = $exists ? $path : $path . '.part';
// }
if ($exists) {
$fileId = $stat['fileid'];
@@ -554,7 +556,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
$this->getCache()->update($fileId, $stat);
} else {
if (!$this->validateWrites || $this->objectStore->objectExists($urn)) {
$this->getCache()->move($uploadPath, $path);
// Here we rename
// $this->getCache()->move($uploadPath, $path);
} else {
$this->getCache()->remove($uploadPath);
throw new \Exception("Object not found after writing (urn: $urn, path: $path)", 404);
+2
View File
@@ -1791,6 +1791,8 @@ class View {
* Get a fileinfo object for files that are ignored in the cache (part files)
*/
private function getPartFileInfo(string $path): \OC\Files\FileInfo {
// For S3 we could actually get the file info here already
// $storage->getCache()->get($internalPath);
$mount = $this->getMount($path);
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($this->getAbsolutePath($path));