Revision 630c1ae7
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 |
|
|
189 | 196 |
my $path = File::Spec->catdir($self->get_rootdir, "webdav", $::auth->client->{id}, $type, $number); |
190 | 197 |
if (!-d $path) { |
191 | 198 |
File::Path::make_path($path, { chmod => 0770 }); |
192 | 199 |
} |
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'); |
|
200 |
my $fname = $basename . '_' . $number . '_' . $dbfile->itime->strftime('%Y%m%d_%H%M%S'); |
|
200 | 201 |
$fname .= '.' . $ext if $ext; |
201 | 202 |
|
202 | 203 |
$main::lxdebug->message(LXDebug->DEBUG2(), "webdav path=" . $path . " filename=" . $fname); |
Auch abrufbar als: Unified diff
Revert "get_webdav: Zeitstempel vor dem letzten . setzen"
This reverts commit 1a5f8c48c797b02bf12daaa7fda04b8d5347a6b3.