silverstripe / silverstripe-assets

Silverstripe Assets component
BSD 3-Clause "New" or "Revised" License
9 stars 66 forks source link

RFC Implement AssetStore::getAsPath() to provide a readonly local path. #116

Open tractorcow opened 6 years ago

tractorcow commented 6 years ago

As highly requested, users of the new abstracted asset backend are not used to not having a local path available.

This implementation would provide a guaranteed local (but readonly) path to a given asset.

For local filesystems, this would return the real local path.

For remote filesystems, getAsStream() would be used to create a temporary file, which is marked for destruction on shutdown.

Firesphere commented 6 years ago

This would solve issues around real life implementations that require a file to be private-only and/or available for tests, without being published.

Getting the protected URL via the backend code for reading would improve usability massively. This should however be "backend only" and not accidentally expose the file.

robbieaverill commented 6 years ago

This would solve issues around real life implementations that require a file to be private-only and/or available for tests, without being published.

You can use TestAssetStore for testing assets

tractorcow commented 6 years ago

@Firesphere URLS and paths are separate. No local path implies a public url is available, and vice versa.

Firesphere commented 6 years ago

@tractorcow I know, I'm just describing the issue I'm running in to while also being on leave and not really paying attention :)

@robbieaverill Using TestAssetStore for production sounds like a recipe for disaster, so not an option

robbieaverill commented 6 years ago

@Firesphere 100%! don't do that