|
6 | 6 | using System.Text; |
7 | 7 | using System.Text.RegularExpressions; |
8 | 8 | using System.Threading; |
| 9 | +using GeneXus.Mail.Util; |
9 | 10 | using GeneXus.Utils; |
| 11 | +using Org.Mentalis.Security.Certificates; |
10 | 12 |
|
11 | 13 | namespace GeneXus.Mail.Internals.Pop3 |
12 | 14 | { |
@@ -142,19 +144,6 @@ public void ReadEntireMessage() |
142 | 144 | } |
143 | 145 | } |
144 | 146 |
|
145 | | - private string FixFileName(string AttachDir, string name) |
146 | | - { |
147 | | - if (string.IsNullOrEmpty(name)) |
148 | | - { |
149 | | - name = Path.GetRandomFileName(); |
150 | | - } |
151 | | - if (Path.Combine(AttachDir, name).Length > 200) |
152 | | - { |
153 | | - name = Path.GetRandomFileName().Replace(".", "") + "." + Path.GetExtension(name); |
154 | | - } |
155 | | - Regex validChars = new Regex(@"[\\\/\*\?\|:<>]"); |
156 | | - return validChars.Replace(name, "_"); |
157 | | - } |
158 | 147 |
|
159 | 148 | private static void FillMonthList() |
160 | 149 | { |
@@ -319,15 +308,7 @@ private string GetFileName(string path, string name, string contentType) |
319 | 308 | extension = "." + ExtensionFromContentType(contentType); |
320 | 309 | } |
321 | 310 |
|
322 | | - int idx = 1; |
323 | | - string nameOri = "" + name; |
324 | | - while(File.Exists(path + name + extension)) |
325 | | - { |
326 | | - name = nameOri + " (" + idx + ")"; |
327 | | - idx = idx + 1; |
328 | | - } |
329 | | - |
330 | | - return FixFileName(path, name + extension); |
| 311 | + return GXMailHelper.FixAndEnsureUniqueFileName(path, name + extension); |
331 | 312 | } |
332 | 313 |
|
333 | 314 | private static string ExtensionFromContentType(string contentType) |
|
0 commit comments