Skip to content

Commit

Permalink
fix: upload text file to html (#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol authored Oct 11, 2024
1 parent ea89719 commit 5ea848a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script/rvd_front
Original file line number Diff line number Diff line change
Expand Up @@ -1900,12 +1900,14 @@ sub _upload_users_csv($c, $csv, $type, $create) {
};

return $c->render(json =>
{ output => $output
{
output => $output
,error => $error
,done => 1
}) if $c->stash('req') eq 'json';

return $c->render(template => "/main/upload_users"
,output => $output
,error => $error
,done => 1
);
Expand Down
15 changes: 15 additions & 0 deletions t/mojo/60_upload.t
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,20 @@ sub _do_test_upload_json_users_pass($mojo) {
}
}

sub test_upload_html() {

$t->get_ok('/admin/users/upload.html')->status_is(200);

my $users = new_domain_name();

$t->post_ok('/admin/users/upload.html' => form => {
type => 'openid'
,create => 0
,users => { content => $users, filename => 'users.txt', 'Content-Type' => 'text/csv' },
}
)->status_is(200);
}

################################################################################

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

_login($t);

test_upload_html();
test_upload_json_fail();

test_upload_json();
Expand Down

0 comments on commit 5ea848a

Please sign in to comment.