don't show number of uploading files when there is only 1 file

Thu, 08 Feb 2024 10:31:19 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 08 Feb 2024 10:31:19 +0100
changeset 24
12ad3393c151
parent 23
cdcb20412dd4
child 25
915131bc3233

don't show number of uploading files when there is only 1 file

application/davcontroller.c file | annotate | diff | comparison | revisions
--- a/application/davcontroller.c	Thu Feb 08 10:29:29 2024 +0100
+++ b/application/davcontroller.c	Thu Feb 08 10:31:19 2024 +0100
@@ -290,12 +290,20 @@
         *sz_uploaded_end = 0;
     }
 
-    cxmutstr label1 = cx_asprintf(
-        "%s/%s   %zu/%zu files",
-        sz_uploaded,
-        sz_total,
-        upload->uploaded_files+upload->uploaded_directories,
-        upload->total_files+upload->total_directories);
+    cxmutstr label1;
+    if (upload->total_files + upload->total_directories > 1) {
+        label1 = cx_asprintf(
+            "%s/%s   %zu/%zu files",
+            sz_uploaded,
+            sz_total,
+            upload->uploaded_files+upload->uploaded_directories,
+            upload->total_files+upload->total_directories);
+    } else {
+        label1 = cx_asprintf(
+            "%s/%s",
+            sz_uploaded,
+            sz_total);
+    }
     ui_set(upload->label_top_left, label1.ptr);
 
     free(sz_total);

mercurial