more fixes
This commit is contained in:
@@ -129,8 +129,25 @@ final class UploadPipelineService
|
||||
$height = is_array($dimensions) && isset($dimensions[1]) ? (int) $dimensions[1] : 1;
|
||||
|
||||
$origExt = strtolower(pathinfo($originalPath, PATHINFO_EXTENSION) ?: '');
|
||||
$downloadFileName = $origFilename;
|
||||
|
||||
if (is_string($originalFileName) && trim($originalFileName) !== '') {
|
||||
$candidate = basename(str_replace('\\', '/', $originalFileName));
|
||||
$candidate = preg_replace('/[\x00-\x1F\x7F]/', '', (string) $candidate) ?? '';
|
||||
$candidate = trim((string) $candidate);
|
||||
|
||||
if ($candidate !== '') {
|
||||
$candidateExt = strtolower((string) pathinfo($candidate, PATHINFO_EXTENSION));
|
||||
if ($candidateExt === '' && $origExt !== '') {
|
||||
$candidate .= '.' . $origExt;
|
||||
}
|
||||
|
||||
$downloadFileName = $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
Artwork::query()->whereKey($artworkId)->update([
|
||||
'file_name' => $origFilename,
|
||||
'file_name' => $downloadFileName,
|
||||
'file_path' => '',
|
||||
'file_size' => (int) filesize($originalPath),
|
||||
'mime_type' => $origMime,
|
||||
|
||||
Reference in New Issue
Block a user