Closed callumbwhyte closed 3 years ago
Looks great @callumbwhyte
The VPP has always been viewed as a specific feature for virtually mapping the media paths but you are right it could be reused for other implementations like XML sitemaps but does it make sense to be moved into the UmbracoFileSystemProviders.Azure package or should it be another package 😱
Thanks @Jeavon
If you'll accept a PR to move this class back into the UmbracoFileSystemProviders.Azure package I'll happily make one, or a modification to this PR? Not sure what the best approach would be here with regards to where the methods to configure the media provider would reside...
hmm, would we even need to keep ConfigureMedia
, could the logic be moved into the media component?
Fantastic point - that's much cleaner. Probably a good idea to also introduce an optional (and hidden OOTB) app setting to allow the path to be configured, else the component needs replacing in it's entirety?
If installed to not use the default route then it seems to use the container name - https://github.com/umbraco-community/UmbracoFileSystemProviders.Azure/blob/develop-umbraco-version-8/src/UmbracoFileSystemProviders.Azure.Media/AzureMediaFileSystemComponent.cs#L36
It's possible you might want to manually set it in an appsetting?
@Jeavon PR updated moving the code into the core project. I left the decision of which path name to use to the container name, as before, to minimise changes.
While the ConfigureMedia
method has been removed and the Configure
method signature changing does constitute a breaking change, I do think the impact of this is minimal. Worth noting somewhere though...
Looks great and yeah will release as v2.1 for the breaking changes, thank you!
One of our projects has multiple "file systems" based off the Azure File System, e.g. for storing content other than Umbraco media.
Whilst trying to configure the contents of one of these file systems to be publicly routable I discovered it's not directly possible with the built in methods to configure a virtual path for a file system other than
IMediaFileSystem
.This is because
FileSystemVirtualPathProvider.Configure()
looks up the media provider from the service locator, regardless of the path passed in. There are no other methods onFileSystemVirtualPathProvider
to register a provider, so you have to callHostingEnvironment.RegisterVirtualPathProvider
directly...This PR:
Configure
method, taking anIFileSystem
and a pathCurrent.MediaFileSystem
into theConfigureMedia
methodConfigure
method in favour of the more explicitConfigureMedia
methodLooking at it, I'm unsure why 95% of this class lives within the
UmbracoFileSystemProviders.Azure.Media
package as it should be globally usable. As the namespace for this class is stillUmbracoFileSystemProviders.Azure
it could be moved without creating too much of a breaking change - theConfigureMedia
method could live on as a static extension insideUmbracoFileSystemProviders.Azure.Media
and call back to the moved class in order to keep responsibilities clean. I haven't done this here, but would be open to making a PR if it makes sense.