-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Description
Which Umbraco version are you using?
17.0.0-rc2
Bug summary
Found this while working on another feature. I haven't checked which versions are affected by this.
Attempting to call the /umbraco/delivery/api/v2/media/item/{path} with a valid path returns a 500 error with the following exception:
System.InvalidOperationException: Wasn't able to get an UmbracoContext
at Umbraco.Extensions.UmbracoContextAccessorExtensions.GetRequiredUmbracoContext(IUmbracoContextAccessor umbracoContextAccessor)
at Umbraco.Cms.Core.Routing.UrlProvider.GetMediaUrl(IPublishedContent content, UrlMode mode, String culture, String propertyAlias, Uri current)
at Umbraco.Cms.Core.DeliveryApi.ApiMediaUrlProvider.GetUrl(IPublishedContent media)
at Umbraco.Cms.Core.DeliveryApi.ApiMediaBuilder.Build(IPublishedContent media)
at Umbraco.Cms.Infrastructure.DeliveryApi.ApiMediaWithCropsBuilderBase`1.Build(MediaWithCrops media)
at Umbraco.Cms.Infrastructure.DeliveryApi.ApiMediaWithCropsBuilderBase`1.Build(IPublishedContent media)
...
Specifics
No response
Steps to reproduce
- Create a new project.
- Enable the Delivery API and Media, with public access enabled.
"Umbraco": {
"CMS": {
...
"DeliveryApi": {
"Enabled": true,
"PublicAccess": true,
"Media": {
"Enabled": true,
"PublicAccess": true
}
}
- Upload an image to the media section.
- Try to retrieve the image using the
/umbraco/delivery/api/v2/media/item/{path}endpoint.
Expected result / actual result
No response