fix BaseRest config management - would throw when missing config files
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RestExtensions>
|
||||
<!--
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracoBase.library.member" alias="currentMember">
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracobase.library.member" alias="currentMember">
|
||||
<permission method="login" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="id" allowAll="true" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- you should use BaseRestExtensions.config instead -->
|
||||
<RestExtensions>
|
||||
<!-- available for backward compatibility only -->
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracoBase.library.member" alias="currentMember">
|
||||
<ext assembly="umbraco" type="umbraco.presentation.umbracobase.library.member" alias="currentMember">
|
||||
<permission method="login" allowAll="true" />
|
||||
<permission method="logout" allowAll="true" />
|
||||
<permission method="id" allowAll="true" />
|
||||
|
||||
@@ -88,6 +88,9 @@ namespace Umbraco.Web.BaseRest
|
||||
|
||||
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
|
||||
|
||||
if (config == null)
|
||||
return null; // does not exist
|
||||
|
||||
// fixme - at the moment we reload the config file each time
|
||||
// we have to support live edits of the config file for backward compatibility reason
|
||||
// so if we want to cache, we'd also need to implement a watcher on the config file...
|
||||
@@ -111,6 +114,9 @@ namespace Umbraco.Web.BaseRest
|
||||
string typeName = eNode.Attributes["type"].Value;
|
||||
Type type = assembly.GetType(typeName);
|
||||
|
||||
if (type == null)
|
||||
return null; // does not exist
|
||||
|
||||
var method = type.GetMethod(methodName);
|
||||
|
||||
if (method == null)
|
||||
@@ -135,6 +141,9 @@ namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
|
||||
|
||||
if (config == null)
|
||||
return null; // does not exist
|
||||
|
||||
Configuration.ExtensionElement configExtension = config.Items[extensionAlias];
|
||||
if (configExtension == null)
|
||||
return null; // does not exist
|
||||
|
||||
Reference in New Issue
Block a user