Skip to content

[6.x] Use a unique temporary path when reading image attributes - #15171

Merged
jasonvarga merged 1 commit into
6.xfrom
image-attributes-temp-copies
Aug 12, 2026
Merged

[6.x] Use a unique temporary path when reading image attributes#15171
jasonvarga merged 1 commit into
6.xfrom
image-attributes-temp-copies

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where reading image attributes from a non-local disk could throw Unable to delete file located at: cache://..., or return 0x0 dimensions.

This was happening because Imaging\Attributes copies files off non-local disks into a temporary local disk so their dimensions can be read locally, and the destination was the source path itself. Every request reading attributes for the same file used the same temporary path, so concurrent requests would clobber and delete each other's copy. It also left an empty directory tree behind on every call.

This PR fixes it by copying to a unique filename per call, and by deleting through the disk (which doesn't throw) rather than the mount manager.

This PR also fixes an issue where those temporary copies could be written into the site's asset container. Since #7887, the local disk shortcut assigned the source disk to $cacheDisk, which is memoized for the lifetime of the request because Attributes is resolved through a real-time facade. Once anything had read attributes off a local disk, every later non-local read copied into that disk instead of the temporary one.

Fixes #7437
Caused by #7887

`Imaging\Attributes` copies files off non-local disks so their dimensions
can be read locally. The destination was the source path itself, so
concurrent requests reading attributes for the same file would clobber
and delete each other's copy, throwing `UnableToDeleteFile` or returning
0x0 dimensions.

The local disk shortcut also assigned the source to `$cacheDisk`, which
is memoized for the lifetime of the request. Any later non-local read
then copied into that disk instead of the temporary one, writing into
the site's asset container.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit b8a9d68 into 6.x Aug 12, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the image-attributes-temp-copies branch August 12, 2026 14:47
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

Successfully merging this pull request may close these issues.

Missing asset attribute throws error, frequently

2 participants