Commit 97580310 authored by ibuler's avatar ibuler

[Update] 可以设置是否显示隐藏内容

parent a697a601
...@@ -345,6 +345,7 @@ defaults = { ...@@ -345,6 +345,7 @@ defaults = {
'SECURITY_MAX_IDLE_TIME': 60, 'SECURITY_MAX_IDLE_TIME': 60,
'ASSET_LIST_PAGE_SIZE': 'auto', 'ASSET_LIST_PAGE_SIZE': 'auto',
'SFTP_ROOT': '/tmp', 'SFTP_ROOT': '/tmp',
'SFTP_SHOW_HIDDEN_FILE': False
} }
......
...@@ -45,7 +45,8 @@ def convert_error(func): ...@@ -45,7 +45,8 @@ def convert_error(func):
class SFTPServer(paramiko.SFTPServerInterface): class SFTPServer(paramiko.SFTPServerInterface):
root = config.SFTP_ROOT # Home or /tmp or other path, must exist on all server # Home or /tmp or other path, must exist on all server
root = config.SFTP_ROOT
def __init__(self, server, **kwargs): def __init__(self, server, **kwargs):
""" """
...@@ -234,6 +235,9 @@ class SFTPServer(paramiko.SFTPServerInterface): ...@@ -234,6 +235,9 @@ class SFTPServer(paramiko.SFTPServerInterface):
else: else:
client, rpath = self.get_sftp_client_rpath(request) client, rpath = self.get_sftp_client_rpath(request)
output = client.listdir_attr(rpath) output = client.listdir_attr(rpath)
show_hidden_file = config['SFTP_SHOW_HIDDEN_FILE']
if not show_hidden_file:
output = [attr for attr in output if not attr.filename.startswith('.')]
return output return output
@convert_error @convert_error
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment