Assets should provide a method to get the "full path" (subfolder + path)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
A developer will commonly need the "full path" of an asset, relative to an aws-s3 bucket.
If the Volume is aws-s3 or google-cloud, craft\elements\Asset::getPath is not sufficient, as those Volume types can have a subfolder.
This should be provided by Craft and not those Volumes specifically, as there are multiple Volumes with a similar subfolder prop.
It may be arguable that getPath should return this full path to begin with, but I'm guessing that would break a lot of other things.
The "full/bucket path" would be needed any time a dev interacts with, e.g. the S3 SDK.
craft\awss3\Plugin does this very thing, here: https://github.com/craftcms/aws-s3/blob/master/src/Plugin.php#L59
Another example in the wild: https://github.com/nystudio107/craft-imageoptimize/blob/v1/src/imagetransforms/ImageTransform.php#L102-L114
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with craft\elements\Asset::getPath and compare its result with the subfolder handling in craftcms/aws-s3 Plugin.php at line 59. Review the referenced AWS S3 and image optimization examples to understand the expected bucket-relative path. Done means exposing the combined subfolder and asset path without changing existing getPath behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, google-cloud, php
- Domain
- backend, cloud
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100