From 1ddc8e16d8bfa6c24af40ed4b7d41a5fdda95a50 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Fri, 20 Feb 2026 17:59:33 +0300
Subject: ark: restore unzip-5 support

See-also: https://mirror.git.trinitydesktop.org/gitea/TDE/tdeutils/pulls/117#issuecomment-82676
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 ark/zip.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ark/zip.cpp b/ark/zip.cpp
index b95c7d5..345f772 100644
--- a/ark/zip.cpp
+++ b/ark/zip.cpp
@@ -40,6 +40,7 @@
 
 // ark includes
 #include "zip.h"
+#include "arkutils.h"
 #include "arkwidget.h"
 #include "settings.h"
 #include "filelistview.h"
@@ -324,22 +325,23 @@ bool ZipArch::processLine( const TQCString &line )
     return false;
   }
 
-  // unzip-6 can be configured at build time to return date in either of three
-  // formats:
+  // unzip can be configured at build time to return date in either of three
+  // formats (for version 6):
   //  - MM-DD-YYYY (the default on *nix systems)
   //  - DD-MM-YYYY (not used by default)
   //  - YYYY-MM-DD (used in several linux distribution e.g. debian)
   // Unfortunately there is no easy way to query unzip which format it does
   // use, so we will have to guestimate here.  Also since the DMY is not widely
   // used and in general case indistinguishable from MDY we will ignore it and
-  // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 unlike
-  // unzip-5 uses 4 digits for years, so it will be relatively painless.
+  // concentrate on distinguishing between MDY and YMD. Luckily unzip-6 uses
+  // 4 digits for years, so it will be relatively painless. On the other hand
+  // unzip-5 uses 2-digits for a year, so in that case always assume MDY.
   TQString date = lineRx.cap(5);
   TQString time = lineRx.cap(6);
-  TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{4,})$"};
+  TQRegExp mdyDateRx{"^([01][0-9])-([0-3][0-9])-([0-9]{2,})$"};
 
   if(mdyDateRx.search(date) != -1) {
-    date = mdyDateRx.cap(3) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2);
+    date = ArkUtils::fixYear(mdyDateRx.cap(3)) + "-" + mdyDateRx.cap(1) + "-" + mdyDateRx.cap(2);
   }
   TQString timestamp = date + " " + time;
 
-- 
cgit v1.2.3

