Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] field upload : the uploaded file link is not correct #5598

Open
rezahmady opened this issue Aug 5, 2024 · 1 comment
Open

[Bug] field upload : the uploaded file link is not correct #5598

rezahmady opened this issue Aug 5, 2024 · 1 comment
Labels

Comments

@rezahmady
Copy link

rezahmady commented Aug 5, 2024

Bug report

What I did

my disk :

'stg1' =>  [
    'driver' => 'ftp',
    ...
    'url' => 'https://{my_domain}/uploads'
]

field :

[
    'name'  => 'url',
    'type' => 'upload',
    'withFiles' => [
        'disk' => 'stg1',
        'path' => 'videos',
    ],
    'fake'  => true,
]

What I expected to happen

download link must be :

https://{my_domain}/uploads/videos/{my_file}

What happened

When I set a disk other than public, the path value set in the upload field is used twice in the download link.

download link :

https://{my_domain}/uploads/videos/videos/{my_file}

What I've already tried to fix it

image

this is your code
what id prefix ??

I set prefix value to '' or '/' but it didn't work

[
    'name'  => 'url',
    'type' => 'upload',
    'prefix' => '',
    'withFiles' => [
        'disk' => 'stg1',
        'path' => 'videos',
        'prefix' => '',
    ],
    'fake'  => true,
]

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there?

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
8.3.6

### PHP EXTENSIONS:
Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, random, readline, Reflection, session, standard, mysqlnd, tokenizer, zlib, libxml, dom, PDO, openssl, SimpleXML, xml, xmlreader, xmlwriter, curl, ftp, fileinfo, gd, intl, mbstring, exif, mysqli, Phar, pdo_mysql, xsl, zip

### LARAVEL VERSION:
10.48.15.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.4
backpack/crud: 6.7.24
backpack/editable-columns: 3.0.9
backpack/filemanager: 3.0.8
backpack/generators: v4.0.5
backpack/logmanager: v5.0.2
backpack/pro: 2.2.4
backpack/revise-operation: 2.0.0
backpack/theme-coreuiv2: 1.2.4
@jcastroa87
Copy link
Member

Hello @rezahmady

I try this today with this version:

### PHP VERSION:
8.3.10

### PHP EXTENSIONS:
Core, date, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dba, dom, hash, FFI, fileinfo, filter, ftp, gd, gettext, gmp, json, iconv, intl, SPL, ldap, mbstring, session, standard, odbc, pcntl, exif, mysqlnd, PDO, pdo_dblib, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, random, readline, Reflection, mysqli, shmop, SimpleXML, soap, sockets, sodium, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, xml, xmlreader, xmlwriter, xsl, zip, Zend OPcache

### LARAVEL VERSION:
11.21.0.0

### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.3.6
backpack/crud: 6.7.33
backpack/devtools: 3.1.6
backpack/generators: v4.0.5
backpack/pro: 2.2.14
backpack/theme-coreuiv2: 1.2.5
backpack/theme-tabler: 1.2.12

Filesystem

'stg1' =>  [
            'driver' => 'ftp',
            'host' => 'test.rebex.net',
            'username' => 'demo',
            'password' => 'password',
            'url' => 'https://bp.test/uploads'
        ],

Controller

CRUD::field([
            'name'  => 'upload',
            'label' => 'Photos',
            'type'  => 'upload',
            'withFiles' => [
                'disk' => 'stg1',
                'path' => 'videos',
            ],
            'fake'  => true,
        ]);

And i get the url

https://domain.test/uploads/videos/File.txt

As i understand this is working normal now.

Let me know if work for you.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants