-
Notifications
You must be signed in to change notification settings - Fork 919
Description
Bug report
What I did
I first added an image column, where the image is stored in S3 and accessed using a temporary (signed) URL:
CRUD::column('logo')->type('image')->disk('s3')->temporary(true)->expiration(10);I then tried to show an upload field in a similar way:
CRUD::column('file')->type('upload')->disk('s3')->temporary(true)->expiration(10);What I expected to happen
I expected a valid temporary URL.
What happened
The temporary URL had expiration time 0.
What I've already tried to fix it
The cause and workaround is hidden in the difference between temporary URL generation in the upload.blade.php and image.blade.php files:
image:
$href = $src = Storage::disk($column['disk'])->temporaryUrl($column['prefix'].$column['value'], now()->addMinutes((int) $column['expiration']));upload:
return asset(\Storage::disk($disk)->temporaryUrl($file_path, Carbon\Carbon::now()->addMinutes($column['temporary'])));In other words, the upload variant should look like this:
CRUD::column('logo')->type('image')->disk('s3')->temporary(10);
Is it a bug in the latest version of Backpack?
Yes, it is in fact present in the main branch in GitHub
Backpack, Laravel, PHP, DB version
When I run php artisan backpack:version the output is:
### PHP VERSION:
8.4.10
### PHP EXTENSIONS:
Core, bcmath, calendar, ctype, date, hash, iconv, json, pcre, random, readline, Reflection, SPL, session, tokenizer, zlib, libxml, dom, filter, standard, PDO, bz2, mysqlnd, SimpleXML, xml, xmlreader, xmlwriter, apcu, mongodb, redis, openssl, curl, ftp, fileinfo, gd, gettext, gmp, intl, ldap, mbstring, mysqli, Phar, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, soap, sodium, xsl, zip, Zend OPcache, xdebug
### LARAVEL VERSION:
12.34.0.0
### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.9
backpack/crud: 6.8.7
backpack/generators: v4.0.7
backpack/permissionmanager: 7.2.2
backpack/theme-tabler: 1.2.18
Additional Information
I am more than happy to provide a PR to make the invocation methods for upload (and upload_file) and image similar. I need some guidance as to which of the two is preferred. The ->temporary(10) way is conciser, the ->temporary(true)->expiration(10) is more clear to what it means.