File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -688,7 +688,11 @@ async fn ax_post_file(
688688 path. pop ( ) ;
689689 }
690690
691- let full_path = format ! ( "{}/{}" , path, file0_filename) ;
691+ let full_path = if path. is_empty ( ) {
692+ file0_filename. clone ( )
693+ } else {
694+ format ! ( "{}/{}" , path, file0_filename)
695+ } ;
692696
693697 // validate path for traversal
694698 match validate_path ( & full_path) {
@@ -814,19 +818,16 @@ async fn ax_post_file(
814818 // Handle buffered file0 case (file0 arrived before path)
815819 if upload_result. is_none ( ) {
816820 if let Some ( tmp) = buffered_file {
817- if path. is_empty ( ) {
818- return (
819- StatusCode :: BAD_REQUEST ,
820- b"Missing path field in upload" . to_vec ( ) ,
821- ) ;
822- }
823-
824821 if path. ends_with ( "/" ) {
825822 debug_log ! ( "Removing trailing /, workaround" ) ;
826823 path. pop ( ) ;
827824 }
828825
829- let full_path = format ! ( "{}/{}" , path, file0_filename) ;
826+ let full_path = if path. is_empty ( ) {
827+ file0_filename. clone ( )
828+ } else {
829+ format ! ( "{}/{}" , path, file0_filename)
830+ } ;
830831
831832 match validate_path ( & full_path) {
832833 Ok ( _) => ( ) ,
You can’t perform that action at this time.
0 commit comments