mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
WebServer: Use human-readable sizes on directory listing
A size is no longer displayed for directories; previously, a size of 4096 was always shown.
This commit is contained in:
parent
cbf39dfddd
commit
1dd0791c7e
Notes:
sideshowbarker
2024-07-16 22:54:10 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/1dd0791c7e Pull-request: https://github.com/SerenityOS/serenity/pull/21096 Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <AK/NumberFormat.h>
|
||||
#include <AK/QuickSort.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/URL.h>
|
||||
|
@ -310,7 +311,7 @@ ErrorOr<void> Client::handle_directory_listing(String const& requested_path, Str
|
|||
TRY(builder.try_append(escape_html_entities(name)));
|
||||
TRY(builder.try_append("</a></td><td> </td>"sv));
|
||||
|
||||
TRY(builder.try_appendff("<td>{:10}</td><td> </td>", st.st_size));
|
||||
TRY(builder.try_appendff("<td>{:10}</td><td> </td>", is_directory ? "-" : human_readable_size(st.st_size)));
|
||||
TRY(builder.try_append("<td>"sv));
|
||||
TRY(builder.try_append(TRY(Core::DateTime::from_timestamp(st.st_mtime).to_string())));
|
||||
TRY(builder.try_append("</td>"sv));
|
||||
|
|
Loading…
Reference in a new issue