Pass the filename from CWS on to the client (#16203)

Этот коммит содержится в:
Nick Misasi
2020-11-03 13:11:18 -05:00
коммит произвёл GitHub
родитель bec4e361a9
Коммит 714435fc4c
2 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@@ -7,7 +7,6 @@ import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
@@ -303,14 +302,14 @@ func getSubscriptionInvoicePDF(c *Context, w http.ResponseWriter, r *http.Reques
return
}
pdfData, appErr := c.App.Cloud().GetInvoicePDF(c.Params.InvoiceId)
pdfData, filename, appErr := c.App.Cloud().GetInvoicePDF(c.Params.InvoiceId)
if appErr != nil {
c.Err = model.NewAppError("Api4.getSuscriptionInvoicePDF", "api.cloud.request_error", nil, appErr.Error(), http.StatusInternalServerError)
return
}
err := writeFileResponse(
fmt.Sprintf("%s.pdf", c.Params.InvoiceId),
filename,
"application/pdf",
int64(binary.Size(pdfData)),
time.Now(),

Просмотреть файл

@@ -19,5 +19,5 @@ type CloudInterface interface {
GetSubscription() (*model.Subscription, *model.AppError)
GetInvoicesForSubscription() ([]*model.Invoice, *model.AppError)
GetInvoicePDF(invoiceID string) ([]byte, *model.AppError)
GetInvoicePDF(invoiceID string) ([]byte, string, *model.AppError)
}