Pass the filename from CWS on to the client (#16203)
Этот коммит содержится в:
@@ -7,7 +7,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
@@ -303,14 +302,14 @@ func getSubscriptionInvoicePDF(c *Context, w http.ResponseWriter, r *http.Reques
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pdfData, appErr := c.App.Cloud().GetInvoicePDF(c.Params.InvoiceId)
|
pdfData, filename, appErr := c.App.Cloud().GetInvoicePDF(c.Params.InvoiceId)
|
||||||
if appErr != nil {
|
if appErr != nil {
|
||||||
c.Err = model.NewAppError("Api4.getSuscriptionInvoicePDF", "api.cloud.request_error", nil, appErr.Error(), http.StatusInternalServerError)
|
c.Err = model.NewAppError("Api4.getSuscriptionInvoicePDF", "api.cloud.request_error", nil, appErr.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err := writeFileResponse(
|
err := writeFileResponse(
|
||||||
fmt.Sprintf("%s.pdf", c.Params.InvoiceId),
|
filename,
|
||||||
"application/pdf",
|
"application/pdf",
|
||||||
int64(binary.Size(pdfData)),
|
int64(binary.Size(pdfData)),
|
||||||
time.Now(),
|
time.Now(),
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ type CloudInterface interface {
|
|||||||
|
|
||||||
GetSubscription() (*model.Subscription, *model.AppError)
|
GetSubscription() (*model.Subscription, *model.AppError)
|
||||||
GetInvoicesForSubscription() ([]*model.Invoice, *model.AppError)
|
GetInvoicesForSubscription() ([]*model.Invoice, *model.AppError)
|
||||||
GetInvoicePDF(invoiceID string) ([]byte, *model.AppError)
|
GetInvoicePDF(invoiceID string) ([]byte, string, *model.AppError)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user