-
-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Labels
Description
The Util saves the adapter with column upload_method as the shortened FQCN in the database, but registration of adapters is done using a custom string.
As such when instantiation occurs, Manager cannot instantiate the given adapter because it doesn't match:
public function setMethod(?UploadAdapter $adapter = null): string
{
return $adapter ? Str::lower(Str::afterLast($adapter::class, '\\')) : 'private-shared';
}
and
public function instantiate(string $adapter): UploadAdapter
{
$configured = $this->adapters()
// Drops adapters that cannot be instantiated due to missing packages.
->filter(function ($available) {
return $available;
})
->get($adapter);
if (!$configured) {
throw new ValidationException(['upload' => "No adapter configured for $adapter"]);
}
$method = Str::camel($adapter);
$driver = $this->events->until(new Instantiate($adapter, $this->util));
if (!$driver && !method_exists($this, $method)) {
throw new ValidationException(['upload' => "Cannot instantiate adapter $adapter"]);
}
return $driver ?? $this->{$method}($this->util);
}
with the example:
BlomstraObjectStorage
being saved as upload_method
blomstraobjectstorage
whereas the adapter is in fact registered with the Manager as blomstra
.
flarum.ERROR: Flarum\Foundation\ValidationException: No adapter configured for blomstraobjectstorage in /var/www/vendor/fof/upload/src/Adapters/Manager.php:70