craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 627 forks source link

[3.2] Image transform on first save points to _tempuploads/user directory #4415

Closed rogertinch closed 5 years ago

rogertinch commented 5 years ago

Description

I have a few preparse fields that run a transform on images when an entry is saved. On the first save of an entry, the transformed URL is returned as https://website.com/images/_tempuploads/user_1/_landscape/snow-buddies-hero-image-1.jpg. Notice the /_tempuploads/user_1/ part of the path. On resave of that entry the transformed URL is returned correctly without that path.

Steps to reproduce

  1. Create new entry and add assets.
  2. Save entry and get server error.
  3. Review entry and see that everything was saved correctly. Make a change then update the entry.
  4. Receive no server error and see that the transformed image URL is correctly updated.

Additional info

rogertinch commented 5 years ago

@brandonkelly some more info. We are hosting the site on the fortrabbit Pro Stack across 4 PHP nodes. I tailed the log while saving a new entry and got the "Internal Server Error" and at the same time this popped up in the log:

2019-06-19T13:04:08Z 2019-06-19 08:04:07 [-][1][ba156e1e5200737bb5c1f081417212a6][warning][craft\services\AssetTransforms::deleteAllTransformData] Unable to delete the file "/srv/app/crafthouse-prod/htdocs/storage/runtime/assets/sources/14332.jpg": unlink(/srv/app/crafthouse-prod/htdocs/storage/runtime/assets/sources/14332.jpg): No such file or directory

brandonkelly commented 5 years ago

Solved via aelvan/Preparse-Field-Craft#56.