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

[4.x]: Error when trying to download a subfolder of assets #16151

Closed
paulgoodfield opened this issue Nov 19, 2024 · 5 comments
Closed

[4.x]: Error when trying to download a subfolder of assets #16151

paulgoodfield opened this issue Nov 19, 2024 · 5 comments
Assignees

Comments

@paulgoodfield
Copy link

What happened?

Description

When trying to download an entire subfolder of assets, the CMS throws an "Invalid Argument – yii\base\InvalidArgumentException. Invalid numeric value:" error.

Steps to reproduce

  1. Click the checkbox next to a subfolder of assets in the Assets area of the control panel
  2. From the "cog" menu at the bottom of the screen, choose the "Download" option

Expected behavior

A zip file containing all assets in the selected subfolder would be downloaded

Actual behavior

Throws InvalidArgumentException. Stack trace in web log file:

2024-11-19 08:50:49 [web.ERROR] [yii\base\InvalidArgumentException] yii\base\InvalidArgumentException: Invalid numeric value:  in /var/www/html/vendor/craftcms/cms/src/helpers/Db.php:599
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/helpers/Db.php(850): craft\helpers\Db::parseParam('elements.id', Array, '=', false, 'integer')
#1 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1481): craft\helpers\Db::parseNumericParam('elements.id', Array)
#2 /var/www/html/vendor/yiisoft/yii2/db/QueryBuilder.php(227): craft\elements\db\ElementQuery->prepare(Object(craft\db\mysql\QueryBuilder))
#3 /var/www/html/vendor/yiisoft/yii2/db/Query.php(157): yii\db\QueryBuilder->build(Object(craft\elements\db\AssetQuery))
#4 /var/www/html/vendor/yiisoft/yii2/db/Query.php(249): yii\db\Query->createCommand(Object(craft\db\Connection))
#5 /var/www/html/vendor/craftcms/cms/src/db/Query.php(252): yii\db\Query->all(NULL)
#6 /var/www/html/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1649): craft\db\Query->all(NULL)
#7 /var/www/html/vendor/craftcms/cms/src/controllers/AssetsController.php(1039): craft\elements\db\ElementQuery->all()
#8 [internal function]: craft\controllers\AssetsController->actionDownloadAsset()
#9 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#11 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('download-asset', Array)
#12 /var/www/html/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->runAction('assets/download...', Array)
#13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(640): craft\web\Application->runAction('assets/download...', Array)
#14 /var/www/html/vendor/craftcms/cms/src/web/Application.php(303): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#15 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#16 /var/www/html/web/index.php(12): yii\base\Application->run()
#17 {main} {"memory":5058344,"exception":"[object] (yii\\base\\InvalidArgumentException(code: 0): Invalid numeric value:  at /var/www/html/vendor/craftcms/cms/src/helpers/Db.php:599)"}

Craft CMS version

4.13.1.1

PHP version

8.1.29

Operating system and version

DDEV 1.23.4 (using 'craftcms' project type)

Database type and version

MariaDB 10.6

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

@brandonkelly
Copy link
Member

  • Click the checkbox next to a subfolder of assets in the Assets area of the control panel
  • From the "cog" menu at the bottom of the screen, choose the "Download" option

This shouldn’t be possible to begin with. The “Download” option is grayed out for me when a subfolder is selected, as it should be.

The bulk action options when a subfolder is selected, showing that only the “Move” action is available.

Are you getting any JavaScript errors on the page that could be preventing things from working properly?

@paulgoodfield
Copy link
Author

Hi @brandonkelly - here's what I'm seeing:

Image

No errors in the console.

@i-just i-just self-assigned this Nov 20, 2024
@i-just
Copy link
Contributor

i-just commented Nov 20, 2024

I can replicate this. Almost all those actions should be disabled for folders. I'm looking into it.

@i-just
Copy link
Contributor

i-just commented Nov 20, 2024

I raised a PR for this. Thanks for reporting!

@brandonkelly
Copy link
Member

Craft 4.13.3 is out with that fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants