From 6643797d380092261fdca4140eafb7c4c7cd8ca5 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Thu, 7 Sep 2023 16:01:45 +0200 Subject: use mojo tempdir function --- lib/JWebmail/Plugin/ServerSideSessionData.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/JWebmail') diff --git a/lib/JWebmail/Plugin/ServerSideSessionData.pm b/lib/JWebmail/Plugin/ServerSideSessionData.pm index c28f6d1..16b68b1 100644 --- a/lib/JWebmail/Plugin/ServerSideSessionData.pm +++ b/lib/JWebmail/Plugin/ServerSideSessionData.pm @@ -6,7 +6,7 @@ use Fcntl qw(:DEFAULT :seek); use Time::HiRes 'sleep'; use Mojo::JSON qw(decode_json encode_json); -use Mojo::File; +use Mojo::File 'tempdir'; use constant { @@ -138,7 +138,11 @@ sub register { my ($self, $app, $conf) = @_; $conf //= {}; - $self->session_directory(Mojo::File->new($conf->{directory} || "/tmp/" . $app->moniker)); + $self->session_directory( + $conf->{directory} + ? Mojo::File->new($conf->{directory}) + : tempdir($app->moniker.'_XXXXXXXXXX', TMPDIR => 1) + ); $self->expiration($conf->{expiration} || $app->sessions->default_expiration); $self->cleanup_interval($conf->{cleanup_interval} || $self->expiration); -- cgit v1.2.3