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

Issue deleting subfolder named '0' causes browser freeze and deletes parent folder #542

Open
PrestaBiz opened this issue Oct 27, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@PrestaBiz
Copy link

CloudPanel version(s) affected

2.4.2

Description

When a folder is created with a subfolder named '0' (zero), attempting to delete the '0' subfolder causes the browser to freeze and unexpectedly removes the parent folder containing it. This issue is critical for the PrestaShop platform, as it relies on creating subfolders named '0' to store images, which risks unintended data loss.

How to reproduce

Open FileManager
Create a new folder
Inside this folder, create a subfolder named '0'
Attempt to delete the subfolder '0'

Possible Solution

No response

Additional Context

No response

@cloudpanel-io cloudpanel-io added bug Something isn't working help wanted Extra attention is needed labels Nov 14, 2024
@cloudpanel-io
Copy link
Owner

We need a javascript expert who help us fixing the issue in: file-manager/assets/filemanager.js

@ccMatrix
Copy link

From what I can debug so far, the error is in the backend. It already returns a wrong id for the folder. I tested it with the following 2 folders:

/tmp/par/0
/tmp/par/test

The return from /file-manager/backend/folders?id=%2Ftmp%2Fpar is:

[
    {
        "value": "0",
        "id": "/tmp/par",
        "size": 4096,
        "date": 1732273452,
        "permissions": "0770",
        "type": "folder"
    },
    {
        "value": "test",
        "id": "/tmp/par/test",
        "size": 4096,
        "date": 1732273623,
        "permissions": "0770",
        "type": "folder"
    }
]

As you can see both folders get the same id but the first folder should have the id /tmp/par/0. This is why the javascript finds the wrong folder and deletes it.

Since the backend is obfuscated I didn't debug further but it is a backend/php issue, not a javascript problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants