Skip to content

Commit 5ea848a

Browse files
authored
fix: upload text file to html (#2104)
1 parent ea89719 commit 5ea848a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

script/rvd_front

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,12 +1900,14 @@ sub _upload_users_csv($c, $csv, $type, $create) {
19001900
};
19011901

19021902
return $c->render(json =>
1903-
{ output => $output
1903+
{
1904+
output => $output
19041905
,error => $error
19051906
,done => 1
19061907
}) if $c->stash('req') eq 'json';
19071908

19081909
return $c->render(template => "/main/upload_users"
1910+
,output => $output
19091911
,error => $error
19101912
,done => 1
19111913
);

t/mojo/60_upload.t

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,20 @@ sub _do_test_upload_json_users_pass($mojo) {
723723
}
724724
}
725725

726+
sub test_upload_html() {
727+
728+
$t->get_ok('/admin/users/upload.html')->status_is(200);
729+
730+
my $users = new_domain_name();
731+
732+
$t->post_ok('/admin/users/upload.html' => form => {
733+
type => 'openid'
734+
,create => 0
735+
,users => { content => $users, filename => 'users.txt', 'Content-Type' => 'text/csv' },
736+
}
737+
)->status_is(200);
738+
}
739+
726740
################################################################################
727741

728742
$ENV{MOJO_MODE} = 'development';
@@ -738,6 +752,7 @@ test_upload_no_admin($t);
738752

739753
_login($t);
740754

755+
test_upload_html();
741756
test_upload_json_fail();
742757

743758
test_upload_json();

0 commit comments

Comments
 (0)