From 14a50f258a0cb24907a3bc6ab72d0bfe3723796f Mon Sep 17 00:00:00 2001
From: Peter Le Bek <peter@hyperplex.net>
Date: Fri, 30 Mar 2012 23:41:19 +0000
Subject: [PATCH] fix ftpd mtime retrieval

---
 src/allmydata/frontends/ftpd.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/frontends/ftpd.py b/src/allmydata/frontends/ftpd.py
index cc2a0a08..6bee4e0a 100644
--- a/src/allmydata/frontends/ftpd.py
+++ b/src/allmydata/frontends/ftpd.py
@@ -201,7 +201,11 @@ class Handler:
             elif key == "hardlinks":
                 value = 1
             elif key == "modified":
-                value = metadata.get("mtime", 0)
+                # follow sftpd convention (i.e. linkmotime in preference to mtime)
+                if "linkmotime" in metadata.get("tahoe", {}):
+                    value = metadata["tahoe"]["linkmotime"]
+                else:
+                    value = metadata.get("mtime", 0)
             elif key == "owner":
                 value = self.username
             elif key == "group":
-- 
2.45.2