Compare commits

..

11 Commits

Author SHA1 Message Date
Sebastiaan Janssen 2f714d0b3e Update MySql.Data dependency 2015-07-16 13:59:19 +02:00
Shannon 0bbcaca067 Add unique id for TextSearch / LuceneSearch
Add unique id for TextSearch / LuceneSearch for each searcher.
2015-07-16 13:52:52 +02:00
Sebastiaan Janssen 55d3d8437a Update number of tattoos 2015-07-16 12:44:10 +02:00
Shannon 9e2ab8507f Fixes c# macro tag parser - it needs to parse all macros contained in the entire string, the regex options were wrong meaning if you tried to add multiple macros without parameters it would fail, have added a unit test for that. 2015-07-16 12:31:07 +02:00
Shannon 6ee6c77d6e bumps version 2015-07-16 11:10:36 +02:00
Shannon 9b5d4e5b08 Moves some logic into StringExtensions, updates tests, adds other tests 2015-07-16 10:40:43 +02:00
Shannon 49f8b530b7 FIX U4-6687: Adding tests for RTE Macro parsing when macroAlias is the first attribute and a new test for multiple Macros of various format. 2015-07-16 09:51:04 +02:00
Shannon 56176d0e36 Fix U4-6687: Can't add multiple instances of a macro in RTE in 7.2.6 without ruining RTE formatting
We found that the MacroTagParser.cs was being greedy and matching all UMBRACO_MACRO tags instead of getting them individually.

macro.service.js was updated for posterity purposes to match the regex in the .cs side, but testing showed that it was functioning as expected without this change.
2015-07-16 09:50:49 +02:00
Shannon ab41c900da Quick stab at testing a method from BackofficeController for U4-6843
* Move GetLegacyActionJs logic into an internal static method so we can test
* Change LegacyJsActionType to internal for testing
* Add tests to verify method can determine between js paths and js blocks, so as not to pass js code into IOHelper.ResolveUrl

Conflicts:
	src/Umbraco.Tests/Umbraco.Tests.csproj
2015-07-16 09:48:04 +02:00
Shannon 90645e5e85 Check for ~/ before using IOHelper.ResolveUrl
An "relative virtual path" exception can be thrown by a path like "umbraco/test.js"
2015-07-16 09:45:18 +02:00
Shannon 872c345ac9 Fix backoffice breaking when Actions use code in their JsSource - U4-6843
This reverts/refactors this pull request: https://github.com/umbraco/Umbraco-CMS/pull/722/files

Since JsSource can be used for a file path or actual javascript, we can't use IOHelper.ResolveUrl here.  Instead we're moving it to the GetLegacyActionJs() method, which already handles deciding if it's a code or a URL.

💩

Conflicts:
	src/umbraco.cms/Actions/Action.cs
2015-07-16 09:44:25 +02:00
23 changed files with 277 additions and 80 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
<dependency id="HtmlAgilityPack" version="[1.4.6, 2.0.0)" />
<dependency id="Lucene.Net" version="[2.9.4.1, 3.0.0.0)" />
<dependency id="SharpZipLib" version="[0.86.0, 1.0.0)" />
<dependency id="MySql.Data" version="[6.9.6, 7.0.0)" />
<dependency id="MySql.Data" version="[6.9.7, 7.0.0)" />
<dependency id="xmlrpcnet" version="[2.5.0, 3.0.0)" />
<dependency id="ClientDependency" version="[1.8.4, 2.0.0)" />
<dependency id="ClientDependency-Mvc" version="[1.8.0, 2.0.0)" />
+1 -1
View File
@@ -1,2 +1,2 @@
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
7.2.7
7.2.8
+2 -2
View File
@@ -11,5 +11,5 @@ using System.Resources;
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("7.2.7")]
[assembly: AssemblyInformationalVersion("7.2.7")]
[assembly: AssemblyFileVersion("7.2.8")]
[assembly: AssemblyInformationalVersion("7.2.8")]
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Configuration
{
public class UmbracoVersion
{
private static readonly Version Version = new Version("7.2.7");
private static readonly Version Version = new Version("7.2.8");
/// <summary>
/// Gets the current version of Umbraco.
+17 -1
View File
@@ -51,7 +51,23 @@ namespace Umbraco.Core.IO
return VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root);
}
[Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")]
public static Attempt<string> TryResolveUrl(string virtualPath)
{
try
{
if (virtualPath.StartsWith("~"))
return Attempt.Succeed(virtualPath.Replace("~", SystemDirectories.Root).Replace("//", "/"));
if (Uri.IsWellFormedUriString(virtualPath, UriKind.Absolute))
return Attempt.Succeed(virtualPath);
return Attempt.Succeed(VirtualPathUtility.ToAbsolute(virtualPath, SystemDirectories.Root));
}
catch (Exception ex)
{
return Attempt.Fail(virtualPath, ex);
}
}
[Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")]
internal static string ResolveUrlsFromTextString(string text)
{
if (UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString)
+1 -1
View File
@@ -12,7 +12,7 @@ namespace Umbraco.Core.Macros
internal class MacroTagParser
{
private static readonly Regex MacroRteContent = new Regex(@"(<!--\s*?)(<\?UMBRACO_MACRO.*?/>)(\s*?-->)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
private static readonly Regex MacroPersistedFormat = new Regex(@"(<\?UMBRACO_MACRO (?:.+)?macroAlias=[""']([^""\'\n\r]+?)[""'].+?)(?:/>|>.*?</\?UMBRACO_MACRO>)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline);
private static readonly Regex MacroPersistedFormat = new Regex(@"(<\?UMBRACO_MACRO (?:.+?)?macroAlias=[""']([^""\'\n\r]+?)[""'].+?)(?:/>|>.*?</\?UMBRACO_MACRO>)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
/// <summary>
/// This formats the persisted string to something useful for the rte so that the macro renders properly since we
+45
View File
@@ -15,6 +15,7 @@ using Umbraco.Core.Configuration;
using System.Web.Security;
using Umbraco.Core.Strings;
using Umbraco.Core.CodeAnnotations;
using Umbraco.Core.IO;
namespace Umbraco.Core
{
@@ -59,6 +60,50 @@ namespace Umbraco.Core
}
/// <summary>
/// Based on the input string, this will detect if the strnig is a JS path or a JS snippet.
/// If a path cannot be determined, then it is assumed to be a snippet the original text is returned
/// with an invalid attempt, otherwise a valid attempt is returned with the resolved path
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <remarks>
/// This is only used for legacy purposes for the Action.JsSource stuff and shouldn't be needed in v8
/// </remarks>
internal static Attempt<string> DetectIsJavaScriptPath(this string input)
{
//validate that this is a url, if it is not, we'll assume that it is a text block and render it as a text
//block instead.
var isValid = true;
if (Uri.IsWellFormedUriString(input, UriKind.RelativeOrAbsolute))
{
//ok it validates, but so does alert('hello'); ! so we need to do more checks
//here are the valid chars in a url without escaping
if (Regex.IsMatch(input, @"[^a-zA-Z0-9-._~:/?#\[\]@!$&'\(\)*\+,%;=]"))
isValid = false;
//we'll have to be smarter and just check for certain js patterns now too!
var jsPatterns = new[] { @"\+\s*\=", @"\);", @"function\s*\(", @"!=", @"==" };
if (jsPatterns.Any(p => Regex.IsMatch(input, p)))
isValid = false;
if (isValid)
{
var resolvedUrlResult = IOHelper.TryResolveUrl(input);
//if the resolution was success, return it, otherwise just return the path, we've detected
// it's a path but maybe it's relative and resolution has failed, etc... in which case we're just
// returning what was given to us.
return resolvedUrlResult.Success
? resolvedUrlResult
: Attempt.Succeed(input);
}
}
return Attempt.Fail(input);
}
/// <summary>
/// This tries to detect a json string, this is not a fail safe way but it is quicker than doing
/// a try/catch when deserializing when it is not json.
+1 -1
View File
@@ -64,7 +64,7 @@
</Reference>
<Reference Include="MySql.Data">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MySql.Data.6.9.6\lib\net45\MySql.Data.dll</HintPath>
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
+16 -16
View File
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.0.0" targetFramework="net45" userInstalled="true" />
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net45" userInstalled="true" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net4" userInstalled="true" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net4" userInstalled="true" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net4" userInstalled="true" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net4" userInstalled="true" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net4" userInstalled="true" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" userInstalled="true" />
<package id="MySql.Data" version="6.9.6" targetFramework="net45" userInstalled="true" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" userInstalled="true" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net4" userInstalled="true" />
<package id="SqlServerCE" version="4.0.0.0" targetFramework="net4" userInstalled="true" />
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net45" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net4" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net4" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net4" />
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net4" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net4" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.9.7" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net4" />
<package id="SqlServerCE" version="4.0.0.0" targetFramework="net4" />
</packages>
@@ -0,0 +1,41 @@
using System.Linq;
using NUnit.Framework;
using Umbraco.Web.Editors;
namespace Umbraco.Tests.Controllers
{
[TestFixture]
public class BackOfficeControllerUnitTests
{
public static object[] TestLegacyJsActionPaths = new object[] {
new string[]
{
"alert('hello');",
"function test() { window.location = 'http://www.google.com'; }",
"function openCourierSecurity(userid){ UmbClientMgr.contentFrame('page?userid=123); }",
@"function openRepository(repo, folder){ UmbClientMgr.contentFrame('page?repo=repo&folder=folder); }
function openTransfer(revision, repo, folder){ UmbClientMgr.contentFrame('page?revision=revision&repo=repo&folder=folder); }",
"umbraco/js/test.js",
"/umbraco/js/test.js",
"~/umbraco/js/test.js"
}
};
[TestCaseSource("TestLegacyJsActionPaths")]
public void Separates_Legacy_JsActions_By_Block_Or_Url(object[] jsActions)
{
var jsBlocks =
BackOfficeController.GetLegacyActionJsForActions(BackOfficeController.LegacyJsActionType.JsBlock,
jsActions.Select(n => n.ToString()));
var jsUrls =
BackOfficeController.GetLegacyActionJsForActions(BackOfficeController.LegacyJsActionType.JsUrl,
jsActions.Select(n => n.ToString()));
Assert.That(jsBlocks.Count() == 4);
Assert.That(jsUrls.Count() == 3);
Assert.That(jsUrls.Last().StartsWith("~/") == false);
}
}
}
@@ -24,6 +24,19 @@ namespace Umbraco.Tests.CoreStrings
ShortStringHelperResolver.Reset();
}
[TestCase("alert('hello');", false)]
[TestCase("~/Test.js", true)]
[TestCase("../Test.js", true)]
[TestCase("/Test.js", true)]
[TestCase("Test.js", true)]
[TestCase("Test.js==", false)]
[TestCase("/Test.js function(){return true;}", false)]
public void Detect_Is_JavaScript_Path(string input, bool result)
{
var output = input.DetectIsJavaScriptPath();
Assert.AreEqual(result, output.Success);
}
[TestCase("hello.txt", "hello")]
[TestCase("this.is.a.Txt", "this.is.a")]
[TestCase("this.is.not.a. Txt", "this.is.not.a. Txt")]
+15 -5
View File
@@ -1,4 +1,5 @@
using NUnit.Framework;
using System;
using NUnit.Framework;
using Umbraco.Core.IO;
namespace Umbraco.Tests.IO
@@ -13,11 +14,20 @@ namespace Umbraco.Tests.IO
public class IOHelperTest
{
[Test]
public void IOHelper_ResolveUrl()
[TestCase("~/Scripts", "/Scripts", null)]
[TestCase("/Scripts", "/Scripts", null)]
[TestCase("../Scripts", "/Scripts", typeof(ArgumentException))]
public void IOHelper_ResolveUrl(string input, string expected, Type expectedExceptionType)
{
var result = IOHelper.ResolveUrl("~/Scripts");
Assert.AreEqual("/Scripts", result);
if (expectedExceptionType != null)
{
Assert.Throws(expectedExceptionType, () => IOHelper.ResolveUrl(input));
}
else
{
var result = IOHelper.ResolveUrl(input);
Assert.AreEqual(expected, result);
}
}
/// <summary>
@@ -132,6 +132,97 @@ namespace Umbraco.Tests.Macros
<p>asdfasdf</p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
}
[Test]
public void Format_RTE_Data_For_Editor_With_Params_When_MacroAlias_Is_First()
{
var content = @"<p>asdfasdf</p>
<p>asdfsadf</p>
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" />
<p>asdfasdf</p>";
var result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
// Assert.AreEqual(@"<p>asdfasdf</p>
//<p>asdfsadf</p>
//<div class=""umb-macro-holder Map mceNonEditable"" test1=""value1"" test2=""value2"">
//<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
//<ins>Macro alias: <strong>Map</strong></ins></div>
//<p>asdfasdf</p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
Assert.AreEqual(@"<p>asdfasdf</p>
<p>asdfsadf</p>
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
<ins>Macro alias: <strong>Map</strong></ins></div>
<p>asdfasdf</p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
}
[Test]
public void Format_RTE_Data_For_Editor_With_Params_When_Multiple_Macros()
{
var content = @"<p>asdfasdf</p>
<p>asdfsadf</p>
<?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" />
<p>asdfsadf</p>
<?UMBRACO_MACRO test1=""value1"" macroAlias=""Map"" test2=""value2"" />
<p>asdfsadf</p>
<?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" />
<p>asdfasdf</p>";
var result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>() { { "test1", "value1" }, { "test2", "value2" } });
// Assert.AreEqual(@"<p>asdfasdf</p>
//<p>asdfsadf</p>
//<div class=""umb-macro-holder Map mceNonEditable"" test1=""value1"" test2=""value2"">
//<!-- <?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" /> -->
//<ins>Macro alias: <strong>Map</strong></ins></div>
//<p>asdfsadf</p>
//<div class=""umb-macro-holder Map mceNonEditable"" test1=""value1"" test2=""value2"">
//<!-- <?UMBRACO_MACRO test1=""value1"" macroAlias=""Map"" test2=""value2"" /> -->
//<ins>Macro alias: <strong>Map</strong></ins></div>
//<p>asdfsadf</p>
//<div class=""umb-macro-holder Map mceNonEditable"" test1=""value1"" test2=""value2"">
//<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
//<ins>Macro alias: <strong>Map</strong></ins></div>
//<p>asdfasdf</p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
Assert.AreEqual(@"<p>asdfasdf</p>
<p>asdfsadf</p>
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
<!-- <?UMBRACO_MACRO test1=""value1"" test2=""value2"" macroAlias=""Map"" /> -->
<ins>Macro alias: <strong>Map</strong></ins></div>
<p>asdfsadf</p>
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
<!-- <?UMBRACO_MACRO test1=""value1"" macroAlias=""Map"" test2=""value2"" /> -->
<ins>Macro alias: <strong>Map</strong></ins></div>
<p>asdfsadf</p>
<div class=""umb-macro-holder mceNonEditable"" test1=""value1"" test2=""value2"">
<!-- <?UMBRACO_MACRO macroAlias=""Map"" test1=""value1"" test2=""value2"" /> -->
<ins>Macro alias: <strong>Map</strong></ins></div>
<p>asdfasdf</p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
}
[Test]
public void Format_RTE_Data_For_Editor_With_Multiple_Macros()
{
var content = @"<p>asdfasdf</p>
<?UMBRACO_MACRO macroAlias=""Breadcrumb"" />
<p>asdfsadf</p>
<p> </p>
<?UMBRACO_MACRO macroAlias=""login"" />
<p> </p>";
var result = MacroTagParser.FormatRichTextPersistedDataForEditor(content, new Dictionary<string, string>());
Assert.AreEqual(@"<p>asdfasdf</p>
<div class=""umb-macro-holder mceNonEditable"">
<!-- <?UMBRACO_MACRO macroAlias=""Breadcrumb"" /> -->
<ins>Macro alias: <strong>Breadcrumb</strong></ins></div>
<p>asdfsadf</p>
<p> </p>
<div class=""umb-macro-holder mceNonEditable"">
<!-- <?UMBRACO_MACRO macroAlias=""login"" /> -->
<ins>Macro alias: <strong>login</strong></ins></div>
<p> </p>".Replace(Environment.NewLine, string.Empty), result.Replace(Environment.NewLine, string.Empty));
}
[Test]
public void Format_RTE_Data_For_Editor_With_Params_Closing_Tag()
{
+1
View File
@@ -169,6 +169,7 @@
<Compile Include="AttemptTests.cs" />
<Compile Include="Cache\CacheRefresherTests.cs" />
<Compile Include="CoreStrings\StringValidationTests.cs" />
<Compile Include="Controllers\BackOfficeControllerUnitTests.cs" />
<Compile Include="FrontEnd\UmbracoHelperTests.cs" />
<Compile Include="Integration\GetCultureTests.cs" />
<Compile Include="Membership\DynamicMemberContentTests.cs" />
@@ -15,7 +15,7 @@ function macroService() {
//This regex will match an alias of anything except characters that are quotes or new lines (for legacy reasons, when new macros are created
// their aliases are cleaned an invalid chars are stripped)
var expression = /(<\?UMBRACO_MACRO (?:.+)?macroAlias=["']([^\"\'\n\r]+?)["'][\s\S]+?)(\/>|>.*?<\/\?UMBRACO_MACRO>)/i;
var expression = /(<\?UMBRACO_MACRO (?:.+?)?macroAlias=["']([^\"\'\n\r]+?)["'][\s\S]+?)(\/>|>.*?<\/\?UMBRACO_MACRO>)/i;
var match = expression.exec(syntax);
if (!match || match.length < 3) {
return null;
@@ -28,7 +28,7 @@ angular.module("umbraco.install").factory('installerService', function($rootScop
'Umbraco is the best of both worlds: 100% free and open source, and backed by a professional and profitable company',
"There's a pretty big chance, you've visited a website powered by Umbraco today",
"'Umbraco-spotting' is the game of spotting big brands running Umbraco",
"At least 3 people have the Umbraco logo tattooed on them",
"At least 4 people have the Umbraco logo tattooed on them",
"'Umbraco' is the danish name for an allen key",
"Umbraco has been around since 2005, that's a looong time in IT",
"More than 400 people from all over the world meet each year in Denmark in June for our annual conference <a target='_blank' href='http://codegarden14.com'>CodeGarden</a>",
@@ -169,12 +169,12 @@
</div>
</div>
<div class="row">
<label for="textSearch" class="radio inline">
<input type="radio" name="searchType" id="textSearch" value="text" ng-model="searcher.searchType" />
<label for="{{searcher.name}}-textSearch" class="radio inline">
<input type="radio" name="searchType" id="{{searcher.name}}-textSearch" value="text" ng-model="searcher.searchType" />
Text Search
</label>
<label for="luceneSearch" class="radio inline">
<input type="radio" name="searchType" id="luceneSearch" value="lucene" ng-model="searcher.searchType" />
<label for="{{searcher.name}}-luceneSearch" class="radio inline">
<input type="radio" name="searchType" id="{{searcher.name}}-luceneSearch" value="lucene" ng-model="searcher.searchType" />
Lucene Search
</label>
</div>
+3 -3
View File
@@ -166,7 +166,7 @@
</Reference>
<Reference Include="MySql.Data">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MySql.Data.6.9.6\lib\net45\MySql.Data.dll</HintPath>
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -2541,9 +2541,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7270</DevelopmentServerPort>
<DevelopmentServerPort>7280</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7270</IISUrl>
<IISUrl>http://localhost:7280</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
+1 -1
View File
@@ -20,7 +20,7 @@
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="MySql.Data" version="6.9.6" targetFramework="net45" />
<package id="MySql.Data" version="6.9.7" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.0" targetFramework="net4" />
+16 -36
View File
@@ -445,48 +445,20 @@ namespace Umbraco.Web.Editors
return JavaScript(result);
}
/// <summary>
/// Renders out all JavaScript references that have bee declared in IActions
/// </summary>
private static IEnumerable<string> GetLegacyActionJs(LegacyJsActionType type)
internal static IEnumerable<string> GetLegacyActionJsForActions(LegacyJsActionType type, IEnumerable<string> values)
{
var blockList = new List<string>();
var urlList = new List<string>();
foreach (var jsFile in global::umbraco.BusinessLogic.Actions.Action.GetJavaScriptFileReferences())
foreach (var jsFile in values)
{
//validate that this is a url, if it is not, we'll assume that it is a text block and render it as a text
//block instead.
var isValid = true;
if (Uri.IsWellFormedUriString(jsFile, UriKind.RelativeOrAbsolute))
var isJsPath = jsFile.DetectIsJavaScriptPath();
if (isJsPath.Success)
{
//ok it validates, but so does alert('hello'); ! so we need to do more checks
//here are the valid chars in a url without escaping
if (Regex.IsMatch(jsFile, @"[^a-zA-Z0-9-._~:/?#\[\]@!$&'\(\)*\+,%;=]"))
isValid = false;
//we'll have to be smarter and just check for certain js patterns now too!
var jsPatterns = new string[] {@"\+\s*\=", @"\);", @"function\s*\(", @"!=", @"=="};
if (jsPatterns.Any(p => Regex.IsMatch(jsFile, p)))
{
isValid = false;
}
if (isValid)
{
//it is a valid URL add to Url list
urlList.Add(jsFile);
}
urlList.Add(isJsPath.Result);
}
else
{
isValid = false;
}
if (isValid == false)
{
//it isn't a valid URL, must be a js block
blockList.Add(jsFile);
blockList.Add(isJsPath.Result);
}
}
@@ -500,8 +472,16 @@ namespace Umbraco.Web.Editors
return blockList;
}
private enum LegacyJsActionType
/// <summary>
/// Renders out all JavaScript references that have bee declared in IActions
/// </summary>
private static IEnumerable<string> GetLegacyActionJs(LegacyJsActionType type)
{
return GetLegacyActionJsForActions(type, global::umbraco.BusinessLogic.Actions.Action.GetJavaScriptFileReferences());
}
internal enum LegacyJsActionType
{
JsBlock,
JsUrl
+1 -1
View File
@@ -89,7 +89,7 @@ namespace umbraco.BusinessLogic.Actions
{
return ActionsResolver.Current.Actions
.Where(x => !string.IsNullOrWhiteSpace(x.JsSource))
.Select(x => IOHelper.ResolveUrl(x.JsSource)).ToList();
.Select(x => x.JsSource).ToList();
//return ActionJsReference;
}
+3 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net4" userInstalled="true" />
<package id="Microsoft.ApplicationBlocks.Data" version="1.0.1559.20655" targetFramework="net4" userInstalled="true" />
<package id="MySql.Data" version="6.9.6" targetFramework="net45" userInstalled="true" />
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net4" />
<package id="Microsoft.ApplicationBlocks.Data" version="1.0.1559.20655" targetFramework="net4" />
<package id="MySql.Data" version="6.9.7" targetFramework="net45" />
</packages>
@@ -78,7 +78,7 @@
</Reference>
<Reference Include="MySql.Data">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MySql.Data.6.9.6\lib\net45\MySql.Data.dll</HintPath>
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />