Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 7b2e66d3

Přidáno uživatelem Vojtěch Bartička před asi 2 roky(ů)

Documents to add expected in base64

Documents sent in the request are all in base64 and have enum to specify either TXT file or a ZIP file

Zobrazit rozdíly:

Backend/Core/Services/DocumentService/DocumentServiceEF.cs
44 44
            {
45 45
                if (documentInfo.Format == Models.Enums.EAddDocumentFormat.PLAINTEXT)
46 46
                {
47
                    SaveDocument(documentInfo.Content, user, documentInfo.Name);
47
                    // TODO hardcoded UTF-8 - maybe do something smarter
48
                    var documentContent = Encoding.UTF8.GetString(Convert.FromBase64String(documentInfo.Content));
49
                    SaveDocument(documentContent, user, documentInfo.Name);
48 50
                }
49
                else if (documentInfo.Format == Models.Enums.EAddDocumentFormat.BASE64)
51
                else if (documentInfo.Format == Models.Enums.EAddDocumentFormat.ZIP)
50 52
                {
51 53
                    var (names, contents) = UnzipDocuments(documentInfo.Content);
52 54
                    for (int i = 0; i < names.Count; i++)
Backend/Models/Enums/EAddDocumentFormat.cs
8 8

  
9 9
public enum EAddDocumentFormat
10 10
{
11
    BASE64,
11
    ZIP,
12 12
    PLAINTEXT
13 13
}

Také k dispozici: Unified diff