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

Impossible to edit an empty file with certain file extensions #986

Open
jonasberge opened this issue Mar 6, 2023 · 2 comments · May be fixed by #988
Open

Impossible to edit an empty file with certain file extensions #986

jonasberge opened this issue Mar 6, 2023 · 2 comments · May be fixed by #988

Comments

@jonasberge
Copy link

I have tested this with the docker image tagged "master" (from Feb 26 2023), logged in as the default admin user (command used: sudo docker run -d -v /media/jonas/renkforce/USERDATA/Minecraft/tinyfilemanager/:/var/www/html/data -p 80:80 --restart=always --name tinyfilemanager tinyfilemanager/tinyfilemanager:master)

I created a new file via the "New Item" button in the header with the name "test.mcfunction". Upon clicking on this file I noticed there is no "Edit" or "Advanced Editor" button. This button exists with other plaintext files (e.g. txt).

Attempting to edit it by using the edit URL for this file yields an empty page with no options to edit the file (http://localhost/index.php?p=data&edit=test.mcfunction).

How can I edit this file through tinyfilemanager, without downloading and uploading it again?

I think all files that aren't definitely binary files should be editable, even if their file extension is unknown.

@prasathmani
Copy link
Owner

@jonasberge
Copy link
Author

Thanks for the response! I already did that as a temporary workaround, but personally, I would suggest to go for a more permanent solution, where the choice of files that get to be edited is less restrictive and more permissive.

Known binary file MIME types (like "application/octet-stream", "video/x-matroska", ...) should be disallowed for text editing, but anything that is plain text ("text/plain" or "application/x-empty" for empty files) should be editable. The PHP mime_content_type function tries to guess the MIME type just from the content, without hard-coding file extensions.

@jonasberge jonasberge linked a pull request Mar 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants