File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ public override IDispatcherContext Dispatcher
65
65
66
66
67
67
68
+ private static readonly string _executableExtensions = "ad ade adp ahk app application appref-ms asp aspx asx bas bat bin cab cdxml cer cfg cgi chi chm cmd cnt com conf cpl crt csh der diagcab dll drv eml exe fon fxp gadget grp hlp hpj hta htt inf ini ins inx isp isu its jar jnlp job js jse jsp key ksh lexe library-ms lnk local lua mad maf mag mam manifest maq mar mas mat mau mav maw mcf mda mdb mde mdt mdw mdz mht mhtml mjs mmc mof msc msg msh msh1 msh2 msh1xml msh2xml mshxml msi msp mst ops osd paf pcd phar php php3 php4 php5 php7 phps php-s pht phtml pif pl plg pm pod prf prg ps1 ps2 ps1xml ps2xml psc1 psc2 psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pyzw pyz rb reg rgs scf scr sct search-ms settingcontent-ms sh shb shs slk sys swf t tmp u3p url vb vbe vbp vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx vtx website wlua ws wsc wsf wsh xbap xll xlsb xlsm xnk xs" ;
69
+
68
70
public virtual bool CanBeDownloaded ( object content , File file )
69
71
{
70
72
var chat = Chat ;
@@ -83,6 +85,12 @@ public virtual bool CanBeDownloaded(object content, File file)
83
85
}
84
86
else if ( content is Document document )
85
87
{
88
+ var extension = System . IO . Path . GetExtension ( document . FileName ) ;
89
+ if ( _executableExtensions . Contains ( extension . TrimStart ( '.' ) ) )
90
+ {
91
+ return false ;
92
+ }
93
+
86
94
return Settings . AutoDownload . ShouldDownloadDocument ( GetChatType ( chat ) , document . DocumentValue . Size ) ;
87
95
}
88
96
else if ( content is Photo photo )
You can’t perform that action at this time.
0 commit comments