From faec06a4f25d238cd2fd5807a0b7d4259c51e6a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 17 Nov 2021 13:06:46 +0100 Subject: [PATCH] =?utf8?q?Shop:=20Erweiterung=20f=C3=BCr=20Dateityp=20im?= =?utf8?q?=20Dateinamen=20auf=20letzten=20.=20begrenzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Hilft zwar nicht bei .tar.gz, aber erstmal besser als vorher --- SL/DB/ShopPart.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SL/DB/ShopPart.pm b/SL/DB/ShopPart.pm index 1df77fd89..190aa2b14 100644 --- a/SL/DB/ShopPart.pm +++ b/SL/DB/ShopPart.pm @@ -57,7 +57,9 @@ sub get_images { my @upload_img = (); foreach my $img (@{ $images }) { my $file = SL::File->get(id => $img->file->id ); - my ($path, $extension) = (split /\./, $file->file_name); + # no good: split("\." , 202.220.pdf) -> invaild extension 220 + # file->extension should be in SL::File, a valid extension may also be 'tar.gz' + my ($path, $extension) = split(/\.([^\.]+)$/, $file->file_name); my $content = File::Slurp::read_file($file->get_file); my $temp ={ ( link => 'data:' . $file->mime_type . ';base64,' . MIME::Base64::encode($content, ""), #$content, # MIME::Base64::encode($content), description => $img->file->title, -- 2.20.1