Revize baf6fc22
Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)
Backend/Backend/Controllers/DocumentController.cs | ||
---|---|---|
8 | 8 |
using RestAPI.Authentication; |
9 | 9 |
using Models.Annotations; |
10 | 10 |
using Core.Services.AnnotationService; |
11 |
using System.Net.Http.Headers; |
|
12 |
using Microsoft.Net.Http.Headers; |
|
13 |
using System.Net.Mime; |
|
11 | 14 | |
12 | 15 |
namespace RestAPI.Controllers; |
13 | 16 | |
... | ... | |
272 | 275 |
{ |
273 | 276 |
var outputStream = annotationService.Export(request); |
274 | 277 | |
275 |
var cd = new System.Net.Mime.ContentDisposition()
|
|
278 |
var cd = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
|
|
276 | 279 |
{ |
277 |
FileName = "export.zip", |
|
278 |
Inline = false, |
|
279 | 280 |
}; |
280 | 281 | |
281 |
Response.Headers.Add("Content-Disposition", cd.ToString());
|
|
282 |
return File(outputStream, "application/zip");
|
|
282 |
Response.Headers.Add(HeaderNames.ContentDisposition, cd.ToString());
|
|
283 |
return File(outputStream, MediaTypeNames.Application.Zip, "export.zip");
|
|
283 | 284 |
} |
284 | 285 |
catch (InvalidOperationException e) |
285 | 286 |
{ |
Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs | ||
---|---|---|
858 | 858 |
foreach (var document in finalAnnotationsToExport.Keys) |
859 | 859 |
{ |
860 | 860 |
var finalAnnotation = finalAnnotationsToExport[document]; |
861 |
if (finalAnnotation == null) |
|
862 |
{ |
|
863 |
continue; |
|
864 |
} |
|
865 | ||
861 | 866 |
finalTagsToExport[finalAnnotation] = context.FinalAnnotationTags |
862 | 867 |
.Include(at => at.Annotation) |
863 | 868 |
.Include(at => at.Tag).ThenInclude(t => t.Category) |
Backend/Core/ZipUtils/Export.cs | ||
---|---|---|
38 | 38 |
} |
39 | 39 | |
40 | 40 |
var finalAnnotation = documentFinalAnnotations[document]; |
41 |
if (finalAnnotation == null) |
|
42 |
{ |
|
43 |
continue; |
|
44 |
} |
|
45 | ||
41 | 46 |
var finalTags = finalAnnotationTags[finalAnnotation].Select(ft => ft as AnnotationTagGeneric).ToList(); |
42 | 47 |
string finalAnnotationInfoJson = DumpAnnotation(finalAnnotation, finalTags, document.Id); |
43 | 48 |
CreateFile(documentDir + "/final.json", finalAnnotationInfoJson, archive); |
Také k dispozici: Unified diff
More changes in export and download