Commit 7c0893d0 authored by unknown's avatar unknown
Browse files

Allow for duplicate file names for a query.

parent e3d7b2bc
Pipeline #170931 passed with stages
in 44 seconds
......@@ -35,22 +35,22 @@ public class HTMLResultPage implements Page {
// Create file
String downloadableFileName = query + ".txt";
File downloadableFile = new File(downloadableFileName);
if (downloadableFile.createNewFile()) {
// File didn't exist previous
FileWriter downloadableFileWriter = new FileWriter(downloadableFileName);
// Write "answer" to file
downloadableFileWriter.write(answer);
// Reference file in html
writer.println("<p>" +
String.format("<a id=\"download_link\" href=\"/%s\" download=\"%s\">", downloadableFileName,
downloadableFileName) +
"Download file</a>" +
"</p>");
downloadableFileWriter.close();
} else {
// File already exists
}
FileWriter downloadableFileWriter = new FileWriter(downloadableFileName);
// Write "answer" to file
downloadableFileWriter.write(answer);
// Reference file in html
writer.println("<p>" +
String.format("<a id=\"download_link\" href=\"/%s\" download=\"%s\">", downloadableFileName,
downloadableFileName) +
"Download file</a>" +
"</p>");
downloadableFileWriter.close();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment