-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
luci-app-filemanager: error opening or downloading files #7490
Comments
Looks like we hit some limit of the JSON-RPC response. The whole download should be rebuilt: // Execute 'cat' to read the file content
fs.exec('cat', [filePath]).then(function(res) { This should be replaced with:
|
Seems a reasonable suggestion. @rdmitry0911 |
That's what See https://github.com/openwrt/luci/blob/master/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js#L172-L190 for an existing example |
Yes, I'll fix this. |
Created a PR to fix this issue |
@rdragonrydr are you able to test that these changes fix your problem? ( just download the file and replace the copy on your router ) |
I think I've done something incorrectly there, the page is not working and I get the error,
I copied the file to /www/luci-static/resources/view/system/. All other LuCI pages still work. Do I need to set permissions? |
try logout then login, also open the JS file in a separate tab and hard refresh it with Ctrl+F5 |
Thanks, I tried that... turned out it was readable only by root after all, but knowing I had the correct file helped. Downloading now works. Clicking the file still gives the same (prior) error. I'm going to hazard a guess the server-side code wasn't shared between the two features, but both were faulty. Editing a binary file probably wouldn't work too well, but that's what the hex editor is for, so I'd still like that to function too. That said, I'd love to see a (plugin?) method to actually view the files if supported by the browser. |
I updated the code in PR to use fs.read_direct() for file reading and now it can edit large binary files |
It's now in PR here Download works as well as hexedit (alt click) of binary files. |
@rdragonrydr can you test #7505 to see whether it resolves your use-case? |
I've tested the new PR. Files appear to download fine still. I was hoping the hex editor would work, but blocking use of both works too. (As one would expect, clicking the editor tab manually just shows "Loading..." or the content of the last editable file. That latter may be a minor issue if it still saves that old file over the new one if you edit it anyway.) I would like if the hex editor worked on binary files, though. |
Hex editor IS working. To invoke it you should use 'ALT' + click on file name. I wrote this in my message and it is written in help tab. |
Evidently it’s not obvious to a user unless they already know it. This discoverability must be improved. Using button captions which change depending on selection is a good Luci paradigm. |
I agree that this can be improved. I would change the message from "Failed to open file: The file does not contain valid text data." to something like this: "Failed to open file: The file does not contain valid text data. Use 'ALT' +click to open this file in Hex editor mode" |
@rdmitry0911 I like the suggestion, but that's going to be annoying if someone's on mobile or a Raspberry Pi with Touchscreen. Not sure who'd do hex editing on mobile, but in a pinch there's probably someone who has. If it detects the file is invalid, is there a way to automatically target the hex editor to open instead? I have checked now, and alt-clicking does work though. Thanks! |
I made some changes in logic. Now it opens non-text files in hex Editor by default. |
Sorry to have taken a while to test it. I have tried your updated filemanager and the hex editor opens automatically. |
@rdragonrydr I removed 'Toggle to ASCII mode' button if the editing file is non text. Please, check if it works for you |
Is there an existing issue for this?
screenshots or captures
No response
Actual behaviour
I installed luci-app-filemanager in the latest stable OS release, but I can't seem to access or download certain file types, or maybe it's by size? I should have plenty of free memory:
I don't have many files at hand to test with, but a text file worked (3K) while images and videos (binary files between 4 and 100M) did not. I SUSPECT it's because these are binary files, and perhaps it's sensitive to one of the bytes, perhaps a null?
I was looking at the code, but LuCI's app-as-JavaScript setup confuses me (where's the backend?) so I'm still not sure why it wouldn't be working. Otherwise I would have raised a PR, but I don't feel confident in fixing the issue.
However, I did see that the download is being stored as a blob in the browser side before it downloads. I've had issues with this in the past with my own web apps, so it's going to likely cause compatibility issues with low end PCs or with mobile devices.
Expected behaviour
I would expect downloading files of any size, format, and type to work, and ideally clicking an image or video would render it in browser.
Steps to reproduce
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt/
git tag
git checkout v24.10.0-rc2
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
(set the device here and enable luci-app-filemanager)
make defconfig
cat diffconfig MV1000.txt >> .config
//NOTE: I also retried this entire process afresh after removing the filebrowser package in case of conflicts. It didn't help.
make diffconfig
make
I uploaded the image, not keeping settings, to the router using the webUI.
I then logged into the webUI, enabled a SD card mountpoint for storage (4 GB ext4), browsed to the files, and attempted to access them, but clicking them (or the download button) did nothing but raise an error.
Renaming the files did not help, if it's checking by extension and not a memory issue.
Additional Information
What browsers do you see the problem on?
Firefox
Relevant log output
The text was updated successfully, but these errors were encountered: