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

S3 assets with spaces in filename throw Exception #1606

aryehraber opened this Issue Sep 25, 2017 · 0 comments


None yet
2 participants

aryehraber commented Sep 25, 2017

Expected behaviour

When viewing a page with an S3 asset that has a space in the filename, I expect it to load correctly.

Actual behaviour

An Exception is thrown in DimensionBuilder:

ErrorException in DimensionBuilder.php line 110:

getimagesize(***/blog/3D Card.jpeg): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported
in DimensionBuilder.php line 110
at HandleExceptions->handleError('2', 'getimagesize(***/blog/3D Card.jpeg): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported ', '/***/statamic/core/Assets/DimensionBuilder.php', '110', array('path' => '***/blog/3D Card.jpeg', 'http_response_header' => array('HTTP/1.1 505 HTTP Version not supported', 'Date: Mon, 25 Sep 17 17:10:39 GMT', 'Connection: close', 'x-amz-id-2: /***', 'x-amz-request-id: ***', 'Content-Type: application/xml')))
at getimagesize('***/blog/3D Card.jpeg') in DimensionBuilder.php line 110
at DimensionBuilder->getImageDimensions('***/blog/3D Card.jpeg') in DimensionBuilder.php line 52
at DimensionBuilder->dimensions() in DimensionBuilder.php line 66
at DimensionBuilder->width() in Asset.php line 377
at Asset->width() in AssetsController.php line 402
at AssetsController->supplementAssetForEditing(object(Asset)) in AssetsController.php line 209
at AssetsController->edit('main', 'blog/3D Card.jpeg')
at call_user_func_array(array(object(AssetsController), 'edit'), array('container' => 'main', 'path' => 'blog/3D Card.jpeg')) in Controller.php line 256

Pages with S3 assets that don't have spaces in the filename work fine and the page loads as expected.


Ensuring the path gets URL encoded beforehand seems to resolve the issue.

In statamic/core/Assets/DimensionBuilder.php on line 110:

$size = getimagesize(\Statamic\API\URL::encode($path));


The above workaround also seems to resolve #1241

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