Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

Closed Issue: Media Selector widget breaks on custom media providers [1707]

$
0
0
Quoting [iaresean](https://www.codeplex.com/site/users/view/iaresean) from thread https://compositec1.codeplex.com/discussions/446557

When using a media selector widget to populate a function that has an IMediaFile parameter I initially get a "< data reference >" error message in the control after selecting a media file.

I am sourcing from a custom media store and provider, so this may be the issue.

I think it could possibly be an issue with the DataReferenceTreeSelector.ascx form control.

```
static bool TryExtractMediaId(string value, out Guid mediaId)
{
if(value.Contains("="))
{
return Guid.TryParse(value.Substring(value.LastIndexOf("=") + 1), out mediaId);
}

if(value.StartsWith("~/media(") && value.EndsWith(")"))
{
int openingBracketOffset = value.IndexOf("(");
int closingBracketOffset = value.IndexOf(")");
string guidStr = value.Substring(openingBracketOffset + 1, closingBracketOffset - openingBracketOffset - 1);
return Guid.TryParse(guidStr, out mediaId);
}
mediaId = Guid.Empty;
return false;
}
```

The media urls that I am providing need to have my custom store identifier included, but it doesn't look like this method takes that into account?
Comments: fixed in the latest build, available in the latest check-in

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>