Skip to content

Commit

Permalink
MID-7941: adding '.csv' format to imported file for import report
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed May 19, 2022
1 parent cee1766 commit 78b9102
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class ImportReportPopupPanel extends BasePanel<ReportType> implements Pop
private static final String ID_CHOSE_FILE = "choseFile";
private static final String ID_NAME_FOR_DATA = "reportDataName";
private static final String ID_FILE_AS_NAME = "fileAsString";

private static final String CSV_SUFFIX = ".csv"; //Import report now support only csv format so we use it

public ImportReportPopupPanel(String id, @NotNull ReportType report) {
super(id, Model.of(report));
Expand Down Expand Up @@ -177,7 +177,7 @@ private void importConfirmPerformed(AjaxRequestTarget target, Model<String> name
String newFilePath;
if (uploadedFile != null) {
String fileName = FilenameUtils.removeExtension(uploadedFile.getClientFileName()) + " " + getDataTime()
+ "." + FilenameUtils.getExtension(uploadedFile.getClientFileName());
+ CSV_SUFFIX;
File newFile = new File(importDir, fileName);
// Check new file, delete if it already exists
if (newFile.exists()) {
Expand All @@ -197,7 +197,7 @@ private void importConfirmPerformed(AjaxRequestTarget target, Model<String> name
return;
}
} else {
newFilePath = new File(importDir, dataName).getAbsolutePath();
newFilePath = new File(importDir, dataName + CSV_SUFFIX).getAbsolutePath();
try {
Files.write(Paths.get(newFilePath), fileStringImport.getObject().getBytes());
} catch (IOException e) {
Expand Down

0 comments on commit 78b9102

Please sign in to comment.