Skip to content

Commit 877b685

Browse files
committed
Fixed problem with file extensions when exporting solutions from contest
1 parent 964f0da commit 877b685

3 files changed

Lines changed: 5 additions & 13 deletions

File tree

Open Judge System/Web/OJS.Web/App_GlobalResources/Global.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Open Judge System/Web/OJS.Web/App_GlobalResources/Global.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@
121121
<value>Open Judge System (OJS)</value>
122122
</data>
123123
<data name="SystemVersion" xml:space="preserve">
124-
<value>1.3.3533.20140419</value>
124+
<value>1.3.3534.20140419</value>
125125
</data>
126126
</root>

Open Judge System/Web/OJS.Web/Areas/Administration/Controllers/ContestsExportController.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public ZipFileResult Solutions(int id, bool compete)
186186
var directoryName =
187187
string.Format("{0} ({1} {2})", participant.UserName, participant.FirstName, participant.LastName)
188188
.ToValidFilePath();
189-
var directory = file.AddDirectoryByName(directoryName);
189+
file.AddDirectoryByName(directoryName);
190190

191191
foreach (var problem in problems)
192192
{
@@ -204,18 +204,10 @@ public ZipFileResult Solutions(int id, bool compete)
204204
if (bestSubmission != null)
205205
{
206206
var fileName =
207-
string.Format("{0}.{1}", problem.Name, bestSubmission.SubmissionType.FileNameExtension)
207+
string.Format("{0}.{1}", problem.Name, bestSubmission.FileExtension ?? bestSubmission.SubmissionType.FileNameExtension)
208208
.ToValidFileName();
209209

210-
byte[] content;
211-
if (bestSubmission.IsBinaryFile)
212-
{
213-
content = bestSubmission.Content;
214-
}
215-
else
216-
{
217-
content = bestSubmission.ContentAsString.ToByteArray();
218-
}
210+
var content = bestSubmission.IsBinaryFile ? bestSubmission.Content : bestSubmission.ContentAsString.ToByteArray();
219211

220212
var entry = file.AddEntry(string.Format("{0}\\{1}", directoryName, fileName), content);
221213
entry.CreationTime = bestSubmission.CreatedOn;

0 commit comments

Comments
 (0)