Revision 0ad9546c
Von Jan Büren vor fast 3 Jahren hinzugefügt
SL/File/Backend/Webdav.pm | ||
---|---|---|
186 | 186 |
} |
187 | 187 |
$main::lxdebug->message(LXDebug->DEBUG2(), "file_name=" . $dbfile->file_name ." number=".$number); |
188 | 188 |
|
189 |
my @fileparts = split(/_/, $dbfile->file_name); |
|
190 |
my $number_ext = pop @fileparts; |
|
191 |
my ($maynumber, $ext) = split(/\./, $number_ext, 2); |
|
192 |
push @fileparts, $maynumber if $maynumber ne $number; |
|
193 |
|
|
194 |
my $basename = join('_', @fileparts); |
|
195 |
|
|
196 | 189 |
my $path = File::Spec->catdir($self->get_rootdir, "webdav", $::auth->client->{id}, $type, $number); |
197 | 190 |
if (!-d $path) { |
198 | 191 |
File::Path::make_path($path, { chmod => 0770 }); |
199 | 192 |
} |
200 |
my $fname = $basename . '_' . $number . '_' . $dbfile->itime->strftime('%Y%m%d_%H%M%S'); |
|
193 |
# simply add the timestring before the last . |
|
194 |
# fails for .tar.gz but the number extraction algorithm failed for all |
|
195 |
# '123 Storno zu 456' cases and doubled the name like: |
|
196 |
# Rechnung_123_Storno_zu_456_202113104 Storno zu 456_20211123_113023 |
|
197 |
# TODO extension should be part of the File Model (filetype) |
|
198 |
my ($filename, $ext) = split(/\.([^\.]+)$/, $dbfile->file_name); |
|
199 |
my $fname = $filename . '_' . $dbfile->itime->strftime('%Y%m%d_%H%M%S'); |
|
201 | 200 |
$fname .= '.' . $ext if $ext; |
202 | 201 |
|
203 | 202 |
$main::lxdebug->message(LXDebug->DEBUG2(), "webdav path=" . $path . " filename=" . $fname); |
Auch abrufbar als: Unified diff
get_webdav: Zeitstempel vor dem letzten . setzen
und nicht aus der Nummer und anderen Infos zusammenbauen