Skip to content

Commit

Permalink
Backgroundjob: ShopPartMassCreate Shopbilder Titel String bereinigen
Browse files Browse the repository at this point in the history
Der Titel String wird shopware seitig als Dateiname verwendet und muss
daher bereinigt werden. (fuehrt ansonsten zu Fehlern bei der
synchronisation)
  • Loading branch information
rebootl committed Nov 5, 2024
1 parent 53548b1 commit 22f2893
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion SL/BackgroundJob/ShopPartMassCreate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ sub get_shop_categories {
return \@shop_categories;
}

sub sanitize_filename {
my ($filename) = @_;
$filename =~ s/\W/_/g;
return $filename;
}

sub _warn {
my ($messages, $message) = @_;
$main::lxdebug->message(LXDebug::WARN(), $message);
Expand Down Expand Up @@ -164,7 +170,7 @@ sub run {
source => 'uploaded',
file_type => 'image',
file_name => $image_name,
title => substr($part->description, 0, 45),
title => sanitize_filename(substr($part->description, 0, 45)),
description => '',
file_contents => $file_data,
file_path => $image_path,
Expand Down

0 comments on commit 22f2893

Please sign in to comment.