This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git


The following commit(s) were added to refs/heads/master by this push:
     new ad214e721 GH-678: print dates in English in ScpShell
ad214e721 is described below

commit ad214e7210d0f0ce8e8cff6b6a062444321f0e8d
Author: Thomas Wolf <tw...@apache.org>
AuthorDate: Sat Mar 8 19:22:05 2025 +0100

    GH-678: print dates in English in ScpShell
    
    No need to expose the server-side locale, and WinSCP only recognizes
    the format if it has English month names.
---
 .../src/main/java/org/apache/sshd/scp/server/ScpShell.java     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sshd-scp/src/main/java/org/apache/sshd/scp/server/ScpShell.java 
b/sshd-scp/src/main/java/org/apache/sshd/scp/server/ScpShell.java
index 98ead95bf..c7f2a888b 100644
--- a/sshd-scp/src/main/java/org/apache/sshd/scp/server/ScpShell.java
+++ b/sshd-scp/src/main/java/org/apache/sshd/scp/server/ScpShell.java
@@ -690,9 +690,13 @@ public class ScpShell extends AbstractFileSystemCommand 
implements ServerChannel
     }
 
     protected static class PathEntry implements Comparable<PathEntry> {
-        public static final DateTimeFormatter FULL_TIME_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd HH:mm:ss yyyy");
-        public static final DateTimeFormatter TIME_ONLY_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd HH:mm");
-        public static final DateTimeFormatter YEAR_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd  yyyy");
+        // WinSCP needs the month names always in English.
+        public static final DateTimeFormatter FULL_TIME_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd HH:mm:ss yyyy",
+                Locale.ENGLISH);
+        public static final DateTimeFormatter TIME_ONLY_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd HH:mm",
+                Locale.ENGLISH);
+        public static final DateTimeFormatter YEAR_VALUE_FORMATTER = 
DateTimeFormatter.ofPattern("MMM ppd  yyyy",
+                Locale.ENGLISH);
 
         protected final Path abs;
         protected final Path path;

Reply via email to