Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RODARE
invenio-uploadbyurl
Commits
47d7a884
Verified
Commit
47d7a884
authored
Feb 06, 2018
by
Huste, Tobias
Browse files
browsing: make number of maximum directories configurable
- maximum number of directories can now be listed via query parameter
parent
e34dad80
Pipeline
#2655
passed with stage
in 9 minutes and 21 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
invenio_uploadbyurl/api.py
View file @
47d7a884
...
...
@@ -160,12 +160,16 @@ class SFTPBrowserAPI(ContentNegotiatedMethodView):
validate
=
path_validator
,
missing
=
'/'
,
),
'max'
:
fields
.
Integer
(
location
=
'query'
,
missing
=
'10000'
,
)
}
@
use_kwargs
(
post_args
)
@
need_authentication
@
cached
(
timeout
=
300
,
key_prefix
=
make_key
,
query_string
=
False
)
def
post
(
self
,
remote_server
,
path
=
'/'
):
def
post
(
self
,
remote_server
,
path
=
'/'
,
max
=
10000
):
"""
Return list of directories and files.
...
...
@@ -214,7 +218,7 @@ class SFTPBrowserAPI(ContentNegotiatedMethodView):
isdir
=
True
,
endpoint
=
endpoint
,
)]
for
element
in
sftp
.
listdir_iter
(
path
):
for
element
in
limit
(
sftp
.
listdir_iter
(
path
)
,
limit
=
max
)
:
# get file size
full_path
=
os
.
path
.
join
(
path
,
element
.
filename
)
endpoint
=
base_url
+
urlencode
({
'path'
:
full_path
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment