Skip to content

Delete request fails after first use — 404 Not Found + JSON.parse error #1276

@mhgolij

Description

@mhgolij

When using Laravel File Manager, the delete operation succeeds on the first deletion but fails on every subsequent deletion with an HTTP 404. The frontend then tries to JSON.parse the non-JSON response and throws an error. I can reproduce this reliably.

Request example (failing)

GET /laravel-filemanager/delete?working_dir=/1&type=&items[]=Firefox_Screenshot_2025-11-18T09-24-07.777Z.png&_=1764747643326
Host: 127.0.0.1:8001

Browser console / network

[HTTP/1.1 404 Not Found 327ms]

Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
    displayErrorResponse laravel-filemanager:1019
    performLfmRequest laravel-filemanager:1014
    jQuery 6
    performLfmRequest laravel-filemanager:1001
    trash laravel-filemanager:1286
    jQuery 9
    performLfmRequest laravel-filemanager:1014
    confirm laravel-filemanager:1545
    trash laravel-filemanager:1280

Steps to reproduce
Open the file manager UI.
Delete a file → succeeds.
Delete a second file (or any additional file) → returns 404.
JS tries to parse the response as JSON and throws JSON.parse error.

Expected behavior
Delete should work on every attempt (consistent behavior), returning a proper JSON response the frontend can parse.

Actual behavior
First delete: OK
From second delete onward: 404 Not Found response, then frontend JSON.parse error.

Additional notes
The failing request URL contains items[] and also a cache-busting _ query parameter (timestamp).
I attempted several local workarounds (changing request method, ajaxSetup, publishing assets, clearing caches, etc.) but none resolved the issue — the problem persists.

Environment

Laravel version: 11.46.1
Laravel File Manager version: 2.12.1
PHP version: >=8.1
Webserver: PHP Built-in Serve
Browser: Firefox 145.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions