Applied patch from mantis #610, fixed invalid filenames with dump_assets_to_file set to true. thanks tyre.
parent
be6d8f6d9a
commit
2fea38a5f2
|
@ -553,7 +553,7 @@ namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(assetPath);
|
Directory.CreateDirectory(assetPath);
|
||||||
}
|
}
|
||||||
FileStream fs = File.Create(Path.Combine(assetPath, filename));
|
FileStream fs = File.Create(Path.Combine(assetPath, Util.safeFileName(filename)));
|
||||||
BinaryWriter bw = new BinaryWriter(fs);
|
BinaryWriter bw = new BinaryWriter(fs);
|
||||||
bw.Write(data);
|
bw.Write(data);
|
||||||
bw.Close();
|
bw.Close();
|
||||||
|
|
|
@ -48,6 +48,12 @@ namespace OpenSim.Framework
|
||||||
private static object XferLock = new object();
|
private static object XferLock = new object();
|
||||||
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
|
private static Dictionary<LLUUID, string> capsURLS = new Dictionary<LLUUID, string>();
|
||||||
|
|
||||||
|
// Get a list of invalid path characters (OS dependent)
|
||||||
|
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
||||||
|
// Get a list of invalid file characters (OS dependent)
|
||||||
|
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
||||||
|
|
||||||
|
|
||||||
#region Vector Equasions
|
#region Vector Equasions
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the distance between two 3d vectors
|
/// Get the distance between two 3d vectors
|
||||||
|
@ -68,7 +74,8 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="a">A 3d vector</param>
|
/// <param name="a">A 3d vector</param>
|
||||||
/// <returns>The magnitude of the vector</returns>
|
/// <returns>The magnitude of the vector</returns>
|
||||||
public static double GetMagnitude(LLVector3 a) {
|
public static double GetMagnitude(LLVector3 a)
|
||||||
|
{
|
||||||
return Math.Sqrt((a.X * a.X) + (a.Y * a.Y) + (a.Z * a.Z));
|
return Math.Sqrt((a.X * a.X) + (a.Y * a.Y) + (a.Z * a.Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,6 +365,28 @@ namespace OpenSim.Framework
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all invalid path chars (OS dependent)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">path</param>
|
||||||
|
/// <returns>safe path</returns>
|
||||||
|
public static string safePath(string path)
|
||||||
|
{
|
||||||
|
return System.Text.RegularExpressions.Regex.Replace(path, @regexInvalidPathChars, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all invalid filename chars (OS dependent)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="path">filename</param>
|
||||||
|
/// <returns>safe filename</returns>
|
||||||
|
public static string safeFileName(string filename)
|
||||||
|
{
|
||||||
|
return System.Text.RegularExpressions.Regex.Replace(filename, @regexInvalidFileChars, string.Empty); ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// directory locations
|
// directory locations
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue