File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -279,7 +279,9 @@ impl<'a> BlobObject<'a> {
279
279
let ext: String = name
280
280
. chars ( )
281
281
. rev ( )
282
- . take_while ( |c| !c. is_whitespace ( ) )
282
+ . take_while ( |c| {
283
+ ( !c. is_ascii_punctuation ( ) || * c == '.' ) && !c. is_whitespace ( ) && !c. is_control ( )
284
+ } )
283
285
. take ( 33 )
284
286
. collect :: < Vec < _ > > ( )
285
287
. iter ( )
@@ -982,6 +984,10 @@ mod tests {
982
984
let ( stem, ext) = BlobObject :: sanitise_name ( "a. tar.tar.gz" ) ;
983
985
assert_eq ! ( stem, "a. tar" ) ;
984
986
assert_eq ! ( ext, ".tar.gz" ) ;
987
+
988
+ let ( stem, ext) = BlobObject :: sanitise_name ( "Guia_uso_GNB (v0.8).pdf" ) ;
989
+ assert_eq ! ( stem, "Guia_uso_GNB (v0.8)" ) ;
990
+ assert_eq ! ( ext, ".pdf" ) ;
985
991
}
986
992
987
993
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
You can’t perform that action at this time.
0 commit comments