File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ pub(crate) mod function {
214
214
Some ( offset_in_seconds)
215
215
}
216
216
217
+ if input. contains ( ':' ) {
218
+ return None ;
219
+ }
217
220
let mut split = input. split_whitespace ( ) ;
218
221
let seconds = split. next ( ) ?;
219
222
let seconds = match seconds. parse :: < SecondsSinceUnixEpoch > ( ) {
Original file line number Diff line number Diff line change @@ -13,6 +13,21 @@ fn special_time_is_ok_for_now() {
13
13
) ;
14
14
}
15
15
16
+ #[ test]
17
+ fn parse_header_is_not_too_lenient ( ) {
18
+ let now = SystemTime :: now ( ) ;
19
+ for not_a_header_str in [ "2005-04-07T22:13:09" , "2005-04-07 22:13:09" ] {
20
+ assert ! (
21
+ gix_date:: parse_header( not_a_header_str) . is_none( ) ,
22
+ "It's not timestamp-like, despite some leniency"
23
+ ) ;
24
+ assert ! (
25
+ gix_date:: parse( not_a_header_str, Some ( now) ) . is_err( ) ,
26
+ "it misses the timezone offset, so can't be parsed"
27
+ ) ;
28
+ }
29
+ }
30
+
16
31
#[ test]
17
32
fn short ( ) {
18
33
assert_eq ! (
You can’t perform that action at this time.
0 commit comments