| 185 | 185 | const file = fileInput.files[0]; |
| 186 | 186 | if (!file) return; |
| 187 | 187 | |
| 188 | + const slug = getStringHash(file.name); |
| 189 | + const fileNamePrefix = `${Date.now()}_${slug}`; |
| 188 | 190 | const fileBase64 = await getBase64Async(file); |
| 189 | 191 | let base64Data = fileBase64.split(',')[1]; |
| 190 | 192 | |
| 191 | 193 | // If file is image |
| 192 | 194 | if (file.type.startsWith('image/')) { |
| 193 | 195 | const extension = file.type.split('/')[1]; |
| 194 | 196 | const imageUrl = await saveBase64AsFile(base64Data, name2, file.namefileNamePrefix, extension); |
| 195 | 197 | message.extra.image = imageUrl; |
| 196 | 198 | message.extra.inline_image = true; |
| 197 | 199 | } else { |
| 198 | 200 | const sluguniqueFileName = getStringHash(file`${fileNamePrefix}.name)txt`; |
| 199 | | - const uniqueFileName = `${Date.now()}_${slug}.txt`; |
| 200 | 201 | |
| 201 | 202 | if (isConvertible(file.type)) { |
| 202 | 203 | try { |