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

Vague error when /storage/runtime/temp isn't writable #2814

Closed
Wiejeben opened this issue Apr 26, 2018 · 1 comment
Closed

Vague error when /storage/runtime/temp isn't writable #2814

Wiejeben opened this issue Apr 26, 2018 · 1 comment

Comments

@Wiejeben
Copy link
Contributor

Wiejeben commented Apr 26, 2018

Description

For some reason I was unable to upload files on my live server. When trying this, I was given a simple JavaScript alert saying "There was a problem with uploading the file.". After some digging and commenting out code, I discovered that this was because /storage/runtime/temp was not writable.

A possible fix would be to improve \craft\controllers\AssetsController::_getUploadedFileTempPath. Right now throw new UploadFailedException(0); is thrown when \craft\web\UploadedFile::saveAsTempFile throws an exception. Having the exception message of \yii\base\ErrorException shown in the JavaScript alert (or web.log) would have made it less confusing to me.

Steps to reproduce

  1. Make sure /storage/runtime/temp is not writable.
  2. Attempt to upload a file

Additional info

  • Craft version: 3.0.4
  • PHP version: 7.0.27
  • Database driver & version: MySQL 5.7.21
  • Plugins & versions: -

Note: I am using Docker, which is why file permissions are a bit more complicated.

@brandonkelly
Copy link
Member

We wouldn’t want to expose the original PHP error, because it will likely contain a file path, which is considered sensitive. However I’ve just updated the exception handling so that it will at least log the original error. So if this crops up again, you can search your logs for “An error occurred when saving an asset”, and you fill find the full exception logged right after that (including the original error).

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

No branches or pull requests

2 participants