Sort filenames in swift indexes
Sort the folders first then the file list for swift indexes. The sorted() function runs on the whole path even though only the basename is displayed. This will still result in the correct order though as the folder paths will be identical. Change-Id: I9c9eb7abad121f23884d58c17771be412e7614c2
This commit is contained in:
parent
fbc4fb4fbd
commit
ee1406f723
@ -235,24 +235,7 @@ def build_file_list(file_path, logserver_prefix, swift_destination_prefix,
|
||||
|
||||
folder_links.append(file_details)
|
||||
|
||||
for f in files:
|
||||
filename = os.path.basename(f)
|
||||
full_path = os.path.join(path, filename)
|
||||
relative_name = os.path.relpath(full_path, parent_dir)
|
||||
url = os.path.join(destination_prefix, relative_name)
|
||||
|
||||
file_details = {
|
||||
'filename': filename,
|
||||
'path': full_path,
|
||||
'relative_name': relative_name,
|
||||
'url': url,
|
||||
'metadata': get_file_metadata(full_path),
|
||||
}
|
||||
|
||||
file_list.append(file_details)
|
||||
folder_links.append(file_details)
|
||||
|
||||
for f in folders:
|
||||
for f in sorted(folders):
|
||||
filename = os.path.basename(f) + '/'
|
||||
full_path = os.path.join(path, filename)
|
||||
relative_name = os.path.relpath(full_path, parent_dir)
|
||||
@ -269,6 +252,23 @@ def build_file_list(file_path, logserver_prefix, swift_destination_prefix,
|
||||
|
||||
folder_links.append(file_details)
|
||||
|
||||
for f in sorted(files):
|
||||
filename = os.path.basename(f)
|
||||
full_path = os.path.join(path, filename)
|
||||
relative_name = os.path.relpath(full_path, parent_dir)
|
||||
url = os.path.join(destination_prefix, relative_name)
|
||||
|
||||
file_details = {
|
||||
'filename': filename,
|
||||
'path': full_path,
|
||||
'relative_name': relative_name,
|
||||
'url': url,
|
||||
'metadata': get_file_metadata(full_path),
|
||||
}
|
||||
|
||||
file_list.append(file_details)
|
||||
folder_links.append(file_details)
|
||||
|
||||
if create_dir_indexes:
|
||||
full_path = make_index_file(
|
||||
folder_links,
|
||||
|
Loading…
Reference in New Issue
Block a user