File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 6
6
<PackageLicenseExpression >MIT</PackageLicenseExpression >
7
7
<PackageProjectUrl >https://github.com/rds1983/AssetManagementBase</PackageProjectUrl >
8
8
<TargetFramework >netstandard2.0</TargetFramework >
9
- <Version >0.6.4 </Version >
9
+ <Version >0.6.5 </Version >
10
10
</PropertyGroup >
11
11
12
12
<PropertyGroup Condition =" '$(Configuration)'=='Release'" >
Original file line number Diff line number Diff line change 1
1
using System . Collections . Generic ;
2
2
using System . IO ;
3
3
using System . Reflection ;
4
+ using System . Text ;
4
5
5
6
namespace AssetManagementBase
6
7
{
@@ -92,6 +93,31 @@ private string BuildFullPath(string assetName)
92
93
assetName = assetName . Replace ( '\\ ' , SeparatorSymbol ) ;
93
94
assetName = CombinePath ( _currentFolder , assetName ) ;
94
95
96
+ if ( assetName . Contains ( ".." ) )
97
+ {
98
+ // Remove ".."
99
+ var parts = assetName . Split ( SeparatorSymbol ) ;
100
+ var sb = new StringBuilder ( ) ;
101
+ sb . Append ( SeparatorSymbol ) ;
102
+
103
+ var partsStack = new List < string > ( ) ;
104
+ for ( var i = 0 ; i < parts . Length ; i ++ )
105
+ {
106
+ if ( parts [ i ] == ".." )
107
+ {
108
+ if ( partsStack . Count > 0 )
109
+ {
110
+ partsStack . RemoveAt ( partsStack . Count - 1 ) ;
111
+ }
112
+ } else if ( ! string . IsNullOrEmpty ( parts [ i ] ) )
113
+ {
114
+ partsStack . Add ( parts [ i ] ) ;
115
+ }
116
+ }
117
+
118
+ assetName = SeparatorSymbol + ( string . Join ( SeparatorString , partsStack ) ) ;
119
+ }
120
+
95
121
return assetName ;
96
122
}
97
123
You can’t perform that action at this time.
0 commit comments