V10: Fix to allow dragged images in the rich text editor to be correctly uploaded (#13016)
* update string extensions IsFullPath to support more filepaths with new built-in Path.IsPathFullyQualified
* resolve TODO to switch to Path.IsPathFullyQualified supported from .NET Standard 2.1
* Use content root instead of web root for uploaded images
* Un-break a breaking change
* handle special parsing of AngularJS json response
* change htmlId selector to support html id's with numbers
* remove bad test case
* test IsFullPath without tricky UNC paths that are not useful
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
(cherry picked from commit d18dc92137)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
963d0018c2
commit
1fe4c5169c
@@ -9,35 +9,6 @@ public class IOHelperWindows : IOHelper
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsPathFullyQualified(string path)
|
||||
{
|
||||
// TODO: This implementation is taken from the .NET Standard 2.1 implementation. We should switch to using Path.IsPathFullyQualified once we are on .NET Standard 2.1
|
||||
if (path.Length < 2)
|
||||
{
|
||||
// It isn't fixed, it must be relative. There is no way to specify a fixed
|
||||
// path with one character (or less).
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path[0] == Path.DirectorySeparatorChar || path[0] == Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
// There is no valid way to specify a relative path with two initial slashes or
|
||||
// \? as ? isn't valid for drive relative paths and \??\ is equivalent to \\?\
|
||||
return path[1] == '?' || path[1] == Path.DirectorySeparatorChar ||
|
||||
path[1] == Path.AltDirectorySeparatorChar;
|
||||
}
|
||||
|
||||
// The only way to specify a fixed path that doesn't begin with two slashes
|
||||
// is the drive, colon, slash format- i.e. C:\
|
||||
return path.Length >= 3
|
||||
&& path[1] == Path.VolumeSeparatorChar
|
||||
&& (path[2] == Path.DirectorySeparatorChar || path[2] == Path.AltDirectorySeparatorChar)
|
||||
|
||||
// To match old behavior we'll check the drive character for validity as the path is technically
|
||||
// not qualified if you don't have a valid drive. "=:\" is the "=" file's default data stream.
|
||||
&& ((path[0] >= 'A' && path[0] <= 'Z') || (path[0] >= 'a' && path[0] <= 'z'));
|
||||
}
|
||||
|
||||
public override bool PathStartsWith(string path, string root, params char[] separators)
|
||||
{
|
||||
// either it is identical to root,
|
||||
|
||||
Reference in New Issue
Block a user