servdhost / craft-asset-storage

MIT License
10 stars 1 forks source link

Bug: Servd Filesystems don't work correctly when using subpath in Asset Volume settings [craft-5] #78

Closed tomdavies closed 7 months ago

tomdavies commented 7 months ago

Craft 5 introduces the ability to re-use Filesystems across multiple Asset Volumes, but it looks like the Servd plugin doesn't support that feature yet.

Detail

Craft: 5.0.0-RC1 Servd Assets and Helpers 4.0.1

It appears that where an Asset Volume is configured to both:

Image Transform URLs are incorrectly formed, in that they include the subfolder from the FS settings, but not the subpath from the Asset volume settings. i.e URLs look like this:

/{{ environment }}/{{subfolder}}/{{ filePath }}?{{ params }}

when they should look like this:

/{{ environment }}/{{subfolder}}/{{ subpath }}/{{ filePath }}?{{ params }}

Example / steps to reproduce

Given the following config

FS settings:

Screenshot 2024-03-26 at 11 57 20

Asset Volume settings:

Screenshot 2024-03-26 at 11 57 45

An image.png asset uploaded to the images Asset Volume will have transform URLs generated of the format:

# URL is missing the subpath "images" from the Asset volume settings ☝️ 
https://project-slug.transforms.svdcdn.com/{{ environment }}/public/image.png?{{ params }}

When they should be of the format:

https://project-slug.transforms.svdcdn.com/{{ environment }}/public/images/image.png?{{ params }}
joeforshaw commented 7 months ago

@tomdavies Just released v4.0.2 which adds support for the new volume subpath. After some discussion, we opted for a /environment/subfolder/subpath/filePath path structure like you suggested. Also, for custom URL patterns defined in the Servd plugin settings, the subpath will folded into the {{ filePath }} placeholder.

Thanks for raising!