refactor(Attachment): :recycle: Simplify extension extraction to one line Removing temporary variable.
Signed| @@ -204,8 +204,7 @@ export async function populateFileAttachment(message, inputId = 'file_form_input | ||
| 204 | 204 | const fileNamePrefix = `${Date.now()}_${slug}`; |
| 205 | 205 | const fileBase64 = await getBase64Async(file); |
| 206 | 206 | let base64Data = fileBase64.split(',')[1]; |
| 207 | - const fileNameParts = file.name.split('.'); | |
| 207 | + const extension = file.name.substring((file.name.lastIndexOf('.') + file.name.length) % file.name.length + 1); | |
| 208 | - const extension = fileNameParts.length > 1 ? fileNameParts.at(-1) : ''; | |
| 209 | 208 | |
| 210 | 209 | // If file is image |
| 211 | 210 | if (file.type.startsWith('image/')) { |