shaonianzhentan / ha_file_explorer

在HomeAssistant里使用的文件管理器
MIT License
173 stars 38 forks source link

文件管理器 无法取得文件列表 #10

Closed zero-coding closed 3 years ago

zero-coding commented 3 years ago

文件管理不显示文件夹列表,v2.4 和 v2.4.17版本是同样问题。

Core 版本: core-2021.5.5 Supervisor版本: 2021.04.3 Host版本: Home Assistant OS 5.13

image

错误日志: Logger: aiohttp.server Source: custom_components/ha_file_explorer/api.py:96 Integration: 文件管理器 (documentation) First occurred: 下午4:04:41 (10 occurrences) Last logged: 下午4:11:07

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle result = await result File "/config/custom_components/ha_file_explorer/init.py", line 106, in post _json = fileExplorer.getDirectory(_path) File "/config/custom_components/ha_file_explorer/api.py", line 66, in getDirectory hashInfo['size'] = self.get_dir_size(join(dir,item)) File "/config/custom_components/ha_file_explorer/api.py", line 96, in get_dir_size size += sum([os.path.getsize(os.path.join(root, name)) for name in files]) File "/config/custom_components/ha_file_explorer/api.py", line 96, in size += sum([os.path.getsize(os.path.join(root, name)) for name in files]) File "/usr/local/lib/python3.8/genericpath.py", line 50, in getsize return os.stat(filename).st_size FileNotFoundError: [Errno 2] No such file or directory: '/config/./node-red/node_modules/.bin/semver'

浏览器端错误:

image

shaonianzhentan commented 3 years ago

FileNotFoundError: [Errno 2] No such file or directory: '/config/./node-red/node_modules/.bin/semver' 这里的文件遍历错误导致的,既然你使用的是HassOS,推荐使用官方的File editor插件

zero-coding commented 3 years ago

虚拟机新装一个又是可以,如果把系统备份导入又不行,不知道是不是系统哪里设置有问题。