Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
final class ArtworkDownloadController extends Controller
@@ -155,10 +156,31 @@ final class ArtworkDownloadController extends Controller
$name = 'artwork';
}
if (strtolower((string) pathinfo($name, PATHINFO_EXTENSION)) !== $ext) {
$name .= '.' . $ext;
$baseName = pathinfo($name, PATHINFO_FILENAME);
$baseName = trim((string) $baseName, ". \t\n\r\0\x0B");
if ($baseName === '') {
$baseName = 'artwork';
}
return $name;
$brandSuffix = $this->downloadBrandSuffix();
if ($brandSuffix !== '' && ! Str::contains(Str::lower($baseName), Str::lower($brandSuffix))) {
$baseName .= ' (' . $brandSuffix . ')';
}
return $baseName . '.' . $ext;
}
private function downloadBrandSuffix(): string
{
$host = (string) parse_url((string) config('app.url'), PHP_URL_HOST);
$host = strtolower(trim($host));
$host = preg_replace('/^www\./', '', $host) ?? '';
if ($host === '' || in_array($host, ['localhost', '127.0.0.1'], true) || str_ends_with($host, '.test')) {
return 'skinbase.top';
}
return $host;
}
}