@@ -214,6 +214,14 @@ private static String OrderAdminSave(HttpContext context)
214214 {
215215 var fname = Path . GetFileName ( ajaxInfo . GetXmlProperty ( "genxml/hidden/optionfilelist" ) ) ;
216216
217+ var ext = Path . GetExtension ( fname ) ;
218+ fname = DnnUtils . Encrypt ( fname , StoreSettings . Current . Get ( "adminpin" ) ) ;
219+ foreach ( char c in System . IO . Path . GetInvalidFileNameChars ( ) )
220+ {
221+ fname = fname . Replace ( c , '_' ) ;
222+ }
223+ fname = ext + "-" + fname ; // add extension to front, so it cannot be servered but we can add to order data.
224+
217225 if ( File . Exists ( StoreSettings . Current . FolderTempMapPath . TrimEnd ( '\\ ' ) + "\\ " + fname ) )
218226 {
219227 var newfname = "secure" + Utils . GetUniqueKey ( ) ;
@@ -229,9 +237,14 @@ private static String OrderAdminSave(HttpContext context)
229237 ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicefilepath" , StoreSettings . Current . FolderUploadsMapPath . TrimEnd ( '\\ ' ) + "\\ " + newfname ) ;
230238 ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicefilename" , newfname ) ;
231239 ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoiceuploadname" , fname ) ;
232- ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicefileext" , Path . GetExtension ( fname ) ) ;
240+
241+ var ext2 = "" ;
242+ var extSplit = fname . Split ( '-' ) ;
243+ if ( extSplit . Count ( ) > 0 ) ext2 = extSplit [ 0 ] ; // we add the extension to the front of upload for IIS default security in serving file.
244+
245+ ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicefileext" , ext2 ) ;
233246 ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicefilerelpath" , StoreSettings . Current . FolderUploads + "/" + newfname ) ;
234- ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicedownloadname" , "NBS " + ordData . OrderNumber + Path . GetExtension ( fname ) ) ;
247+ ordData . PurchaseInfo . SetXmlProperty ( "genxml/hidden/invoicedownloadname" , "OS " + ordData . OrderNumber + ext2 ) ;
235248 }
236249 }
237250
0 commit comments