omeka-s-modules / FileSideload

GNU General Public License v3.0
2 stars 3 forks source link

Item editing error #32

Closed allanaaa closed 1 year ago

allanaaa commented 1 year ago

When File Sideload is activated, clicking on "Edit item" gets me:

Omeka S encountered an error

TypeError SplFileInfo::__construct() expects parameter 1 to be a valid path, bool given

Details:

TypeError: SplFileInfo::__construct() expects parameter 1 to be a valid path, bool given in /var/www/html/amayer/amayer-s/omeka-s/modules/FileSideload/src/Media/Ingester/SideloadDir.php:222 Stack trace:

0 /var/www/html/amayer/amayer-s/omeka-s/modules/FileSideload/src/Media/Ingester/SideloadDir.php(222): SplFileInfo->__construct(false)

1 /var/www/html/amayer/amayer-s/omeka-s/modules/FileSideload/src/Media/Ingester/SideloadDir.php(176): FileSideload\Media\Ingester\SideloadDir->listDirs()

2 /var/www/html/amayer/amayer-s/omeka-s/application/view/common/media-field-wrapper.phtml(21): FileSideload\Media\Ingester\SideloadDir->form(Object(Laminas\View\Renderer\PhpRenderer), Array)

3 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(519): include('/var/www/html/a...')

4 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-view/src/Helper/Partial.php(63): Laminas\View\Renderer\PhpRenderer->render(NULL, NULL)

5 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-view/src/Renderer/PhpRenderer.php(407): Laminas\View\Helper\Partial->__invoke('common/media-fi...', Array)

6 /var/www/html/amayer/amayer-s/omeka-s/application/src/View/Helper/Media.php(87): Laminas\View\Renderer\PhpRenderer->__call('partial', Array)

7 /var/www/html/amayer/amayer-s/omeka-s/application/src/Controller/Admin/ItemController.php(383): Omeka\View\Helper\Media->form('sideload_dir')

8 /var/www/html/amayer/amayer-s/omeka-s/application/src/Controller/Admin/ItemController.php(267): Omeka\Controller\Admin\ItemController->getMediaForms()

9 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(71): Omeka\Controller\Admin\ItemController->editAction()

10 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\Controller\AbstractActionController->onDispatch(Object(Laminas\Mvc\MvcEvent))

11 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

12 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(97): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

13 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-mvc/src/DispatchListener.php(132): Laminas\Mvc\Controller\AbstractController->dispatch(Object(Laminas\Http\PhpEnvironment\Request), Object(Laminas\Http\PhpEnvironment\Response))

14 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(319): Laminas\Mvc\DispatchListener->onDispatch(Object(Laminas\Mvc\MvcEvent))

15 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-eventmanager/src/EventManager.php(179): Laminas\EventManager\EventManager->triggerListeners(Object(Laminas\Mvc\MvcEvent), Object(Closure))

16 /var/www/html/amayer/amayer-s/omeka-s/vendor/laminas/laminas-mvc/src/Application.php(325): Laminas\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Laminas\Mvc\MvcEvent))

17 /var/www/html/amayer/amayer-s/omeka-s/index.php(21): Laminas\Mvc\Application->run()

18 {main}

allanaaa commented 1 year ago

Oh, this is because I updated the module and now it can't find the directory I gave it earlier. Maybe this just needs better error-reporting, like when the module is updated and/or activated it should go right back to the config page and show the directory error there.

zerocrates commented 1 year ago

Just to rule things out: you have the sideload directory configured to something that exists or no?

I see as I'm writing this that it's that. Minimally some better error reporting of the "can't find the directory" case is probably in order.

zerocrates commented 1 year ago

There's no reason per se that updating or activating would mess with the folder... I assume the issue here is that you put your sideload files folder within the sideload module folder and you lost it when replacing the folder during the upgrade? We may also just want to document that you might not want to do that for this reason.

allanaaa commented 1 year ago

I've re-created the directory now, without doing anything on the config page, and now I'm getting: filesideload

Maybe the error message can just display here instead of breaking the whole item editing system.

allanaaa commented 1 year ago

There's no reason per se that updating or activating would mess with the folder... I assume the issue here is that you put your sideload files folder within the sideload module folder and you lost it when replacing the folder during the upgrade? We may also just want to document that you might not want to do that for this reason.

Yeah, that's a fair point! I think our documentation expressly says to do that right now. I still vote for better error messages.

zerocrates commented 1 year ago

Yeah, a missing directory should not be breaking everything for sure.

I assume the issue here is that there's a check to make sure you don't set it wrong to begin with, so people just haven't seen as much the case where the folder gets deleted out from underneath a once-good setting.

allanaaa commented 1 year ago

When you set it in the config page, it will refresh the config page with an error message there. So yeah, that's taken care of.