Commit 97580310 authored by ibuler's avatar ibuler

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

parent a697a601
......@@ -345,6 +345,7 @@ defaults = {
'SECURITY_MAX_IDLE_TIME': 60,
'ASSET_LIST_PAGE_SIZE': 'auto',
'SFTP_ROOT': '/tmp',
'SFTP_SHOW_HIDDEN_FILE': False
}
......
......@@ -45,7 +45,8 @@ def convert_error(func):
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):
"""
......@@ -234,6 +235,9 @@ class SFTPServer(paramiko.SFTPServerInterface):
else:
client, rpath = self.get_sftp_client_rpath(request)
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
@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