diff --git a/components/editorControls/uploadfield/uploadField.cs b/components/editorControls/uploadfield/uploadField.cs index 5aea8ef7a2..bb335e2eda 100644 --- a/components/editorControls/uploadfield/uploadField.cs +++ b/components/editorControls/uploadfield/uploadField.cs @@ -112,7 +112,12 @@ namespace umbraco.editorControls _fullFilePath = IOHelper.MapPath(SystemDirectories.Media + "/" + _data.PropertyId.ToString() + "/" + filename); this.PostedFile.SaveAs(_fullFilePath); - _data.Value = SystemDirectories.Media + "/" + _data.PropertyId + "/" + filename; + //if we are not in a virtual dir, just save without the ~ + string _relFilePath = SystemDirectories.Media + "/" + _data.PropertyId + "/" + filename; + if (SystemDirectories.Root == string.Empty) + _relFilePath = _relFilePath.TrimStart('~'); + + _data.Value = _relFilePath; } else { @@ -122,7 +127,12 @@ namespace umbraco.editorControls _fullFilePath = IOHelper.MapPath(SystemDirectories.Media + "/" + filename); this.PostedFile.SaveAs(_fullFilePath); - _data.Value = SystemDirectories.Media+ "/" + filename; + //if we are not in a virtual dir, just save without the ~ + string _relFilePath = SystemDirectories.Media + "/" + filename; + if (SystemDirectories.Root == string.Empty) + _relFilePath = _relFilePath.TrimStart('~'); + + _data.Value = _relFilePath; } // hack to find master page prefix client id @@ -199,10 +209,18 @@ namespace umbraco.editorControls if (_thumbnails != "") { - string[] thumbnailSizes = _thumbnails.Split(";".ToCharArray()); + char sep = ';'; + + if(!_thumbnails.Contains(sep.ToString()) && _thumbnails.Contains(",")) + sep = ','; + + string[] thumbnailSizes = _thumbnails.Split(sep); foreach (string thumb in thumbnailSizes) - if (thumb != "") - generateThumbnail(image, int.Parse(thumb), fileWidth, fileHeight, _fullFilePath, ext, fileNameThumb + "_" + thumb + _thumbnailext); + { + int _thum = 0; + if (thumb != "" && int.TryParse(thumb, out _thum)) + generateThumbnail(image, _thum, fileWidth, fileHeight, _fullFilePath, ext, fileNameThumb + "_" + thumb + _thumbnailext); + } } image.Dispose(); @@ -363,12 +381,12 @@ namespace umbraco.editorControls thumb.ImageUrl = fileNameThumb; thumb.BorderStyle = BorderStyle.None; - output.WriteLine(""); + output.WriteLine(""); thumb.RenderControl(output); output.WriteLine("
"); } else - output.WriteLine("" + this.Text + "
"); + output.WriteLine("" + IOHelper.ResolveUrl(this.Text) + "
"); output.WriteLine("
"); } base.Render(output); diff --git a/umbraco/presentation/library.cs b/umbraco/presentation/library.cs index 774bef2d82..bf7e30b0d8 100644 --- a/umbraco/presentation/library.cs +++ b/umbraco/presentation/library.cs @@ -370,6 +370,11 @@ namespace umbraco return niceUrlDo(nodeID, 1); } + public static string ResolveVirtualPath(string path) + { + return IOHelper.ResolveUrl(path); + } + private static string niceUrlDo(int nodeID, int startNodeDepth) { XmlDocument umbracoXML = content.Instance.XmlContent;