Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix test of IConstructableStorage implentation by storage classes #48446

Merged
merged 1 commit into from
Sep 30, 2024
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
2 changes: 1 addition & 1 deletion apps/files_external/lib/Config/ConfigAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
if (!is_subclass_of($objectClass, IObjectStore::class)) {
throw new \InvalidArgumentException('Invalid object store');
}
$storage->setBackendOption('objectstore', new $objectClass($objectStore));

Check failure on line 53 in apps/files_external/lib/Config/ConfigAdapter.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedCallable

apps/files_external/lib/Config/ConfigAdapter.php:53:50: TaintedCallable: Detected tainted text (see https://psalm.dev/243)
}

$storage->getAuthMechanism()->manipulateStorageConfig($storage, $user);
Expand All @@ -64,7 +64,7 @@
*/
private function constructStorage(StorageConfig $storageConfig): IStorage {
$class = $storageConfig->getBackend()->getStorageClass();
if (!$class instanceof IConstructableStorage) {
if (!is_a($class, IConstructableStorage::class, true)) {
\OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
}
$storage = new $class($storageConfig->getBackendOptions());
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Storage/StorageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function removeStorageWrapper($wrapperName): void {
* @return IStorage
*/
public function getInstance(IMountPoint $mountPoint, $class, $arguments): IStorage {
if (!($class instanceof IConstructableStorage)) {
if (!is_a($class, IConstructableStorage::class, true)) {
\OCP\Server::get(LoggerInterface::class)->warning('Building a storage not implementing IConstructableStorage is deprecated since 31.0.0', ['class' => $class]);
}
return $this->wrap($mountPoint, new $class($arguments));
Expand Down
Loading