more fixes
This commit is contained in:
@@ -341,8 +341,23 @@ final class StudioArtworksApiController extends Controller
|
||||
|
||||
// 4. Update the artwork's file-serving fields (hash drives thumbnail URLs)
|
||||
$origExt = strtolower(pathinfo($originalPath, PATHINFO_EXTENSION) ?: '');
|
||||
$displayFileName = $origFilename;
|
||||
|
||||
$clientName = basename(str_replace('\\', '/', (string) $file->getClientOriginalName()));
|
||||
$clientName = preg_replace('/[\x00-\x1F\x7F]/', '', (string) $clientName) ?? '';
|
||||
$clientName = trim((string) $clientName);
|
||||
|
||||
if ($clientName !== '') {
|
||||
$clientExt = strtolower((string) pathinfo($clientName, PATHINFO_EXTENSION));
|
||||
if ($clientExt === '' && $origExt !== '') {
|
||||
$clientName .= '.' . $origExt;
|
||||
}
|
||||
|
||||
$displayFileName = $clientName;
|
||||
}
|
||||
|
||||
$artwork->update([
|
||||
'file_name' => $origFilename,
|
||||
'file_name' => $displayFileName,
|
||||
'file_path' => '',
|
||||
'file_size' => $size,
|
||||
'mime_type' => $origMime,
|
||||
|
||||
Reference in New Issue
Block a user