Skip to content

Manage Media - unused files throws datatables error (under specific circumstances) #5198

@BertKoor

Description

@BertKoor

Report triggered through forum discussion...

Click path: Control Panel -> Manage Media. Then select "unused files".

This shows an error:

DataTables warning: table id=DataTables_Table_0 - Invalid JSON response.
For more information about this error, please see https://datatables.net/tn/1

Speficic conditions under which it fails:

  • The feature "Pretty URLs" must be disabled (rewrite_urls="0" in the config.ini.php)
  • The used browser is Chrome or Opera (maybe others as well, it succeeds normally with Safari)

The XHR response for /index.php?route=%2Fadmin%2Fmedia-data&files=unused&media_folder=media%2F&subfolders=exclude&draw=1&... shows a normal http status code of 200, with an error payload:

<div class="alert alert-danger" role="alert" style="white-space: pre-wrap;">Undefined array key 1 …/app/Services/DatatablesService.php:79
#0 …/app/Services/DatatablesService.php(79): Fisharebest\Webtrees\Http\Middleware\ErrorHandler-&gt;errorHandler()
#1 [internal function]: Fisharebest\Webtrees\Services\DatatablesService::Fisharebest\Webtrees\Services\{closure}()
#2 …/vendor/illuminate/collections/Collection.php(1495): uasort()
#3 …/app/Services/DatatablesService.php(77): Illuminate\Support\Collection-&gt;sort()
#4 …/app/Http/RequestHandlers/ManageMediaData.php(266): Fisharebest\Webtrees\Services\DatatablesService-&gt;handleCollection()
#5 …/app/Http/Middleware/RequestHandler.php(52): Fisharebest\Webtrees\Http\RequestHandlers\ManageMediaData-&gt;handle()
#6 …/app/Http/Dispatcher.php(76): Fisharebest\Webtrees\Http\Middleware\RequestHandler-&gt;process()
#7 …/app/Module/HitCountFooterModule.php(149): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#8 …/app/Http/Dispatcher.php(76): Fisharebest\Webtrees\Module\HitCountFooterModule-&gt;process()
#9 …/app/Module/CheckForNewVersion.php(112): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()
#10 …/app/Http/Dispatcher.php(76): Fisharebest\Webtrees\Module\CheckForNewVersion-&gt;process()
#11 …/app/Http/Middleware/CheckCsrf.php(80): Psr\Http\Server\RequestHandlerInterface@anonymous-&gt;handle()

Request initator chain:

  • /index.php?route=%2Fadmin%2Fmedia
    • /index.php?route=%2Fadmin%2Fmedia&files=unused&media_folder=media%2F&subfolders=exclude
      • /public/js/vendor.min.js?v=2.2.4
        • /index.php?route=%2Fadmin%2Fmedia-data&files=unused&media_folder=media%2F&subfolders=exclude&draw=1&...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions