fix ftpd mtime retrieval
authorPeter Le Bek <peter@hyperplex.net>
Fri, 30 Mar 2012 23:41:19 +0000 (23:41 +0000)
committerPeter Le Bek <peter@hyperplex.net>
Fri, 30 Mar 2012 23:41:19 +0000 (23:41 +0000)
src/allmydata/frontends/ftpd.py

index cc2a0a084ecdaecf44eea46ef88918e631690669..6bee4e0a6919ffc49835ef41882fcb55690d8027 100644 (file)
@@ -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":