File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
src/dotnetframework/GxClasses/Printer
test/DotNetUnitTest/FileIO Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ namespace GeneXus.Printer
1616 using System . Threading ;
1717 using System . Threading . Tasks ;
1818 using GeneXus . Configuration ;
19+ using GeneXus . Utils ;
1920 using GeneXus . XML ;
2021
2122 public interface IPrintHandler
@@ -2162,10 +2163,19 @@ public class ReportUtils
21622163 {
21632164 static public string AddPath ( string name , string path )
21642165 {
2165- if ( Path . IsPathRooted ( name ) || name . IndexOf ( ":" ) != - 1 ||
2166+ if ( name . IndexOf ( ":" ) != - 1 ||
21662167 ( name . Length >= 2 && ( name . Substring ( 0 , 2 ) == "//" || name . Substring ( 0 , 2 ) == @"\\" ) ) ||
21672168 ( name . StartsWith ( "http:" ) || name . StartsWith ( "https:" ) ) )
21682169 return name ;
2170+ #if NETCORE
2171+ if ( Path . IsPathRooted ( name ) )
2172+ return name ;
2173+ #else
2174+ if ( PathUtil . IsValidFilePath ( name ) && Path . IsPathRooted ( name ) )
2175+ {
2176+ return name ;
2177+ }
2178+ #endif
21692179 return Path . Combine ( path , name ) ;
21702180 }
21712181 }
Original file line number Diff line number Diff line change @@ -117,5 +117,15 @@ public void ReportUtilAddPathHttp()
117117 string fullPath = ReportUtils . AddPath ( name , path ) ;
118118 Assert . Equal ( name , fullPath ) ;
119119 }
120+ [ Fact ]
121+ public void ReportUtilAddPathWithIllegalCharacters ( )
122+ {
123+ string name = "https://chart.googleapis.com/chart?chs=400x400&cht=qr&chl=http://sistemas.gov/nfceweb/consultarNFCe.jsp?p=13231205514674000128650020009504049878593990|2|1|09|1337.07|4558626967746769617A304E4B7A6D34504B4E61524A474F4D32513D|1|14D0A30916C6C7EA709E7E33E330EE3F290FE25D" ;
124+ string path = "C:/Models/Report/NETModel/Web/" ;
125+ string fullPath = ReportUtils . AddPath ( name , path ) ;
126+
127+ Assert . Equal ( name , fullPath ) ;
128+ }
129+
120130 }
121131}
You can’t perform that action at this time.
0 commit comments