Skip to content

Commit 9cf3b55

Browse files
committed
Correctly part filename and extension
1 parent be1f244 commit 9cf3b55

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/file.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ export class FileService {
226226
if (blob != null) {
227227
if (blob.type === 'text/csv') {
228228
// use the .csv extension explicitly if the MIME type is csv
229-
filename = filename.split('.')[0] + '.csv';
229+
const extensionIndex: number = filename.lastIndexOf('.');
230+
filename = extensionIndex > -1 ? filename.substring(0, extensionIndex) + '.csv' : filename + '.csv';
230231
}
231232
saveAs(blob, filename);
232233
}

0 commit comments

Comments
 (0)