Compare commits

...

2 Commits

Author SHA1 Message Date
Mythie
9e8d0ac906 v1.8.1-rc.4 2024-12-02 22:07:31 +11:00
Mythie
f27d0f342c fix: putPdfFile to always include file extension 2024-12-02 22:06:53 +11:00
8 changed files with 24 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "@documenso/marketing", "name": "@documenso/marketing",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"private": true, "private": true,
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@documenso/web", "name": "@documenso/web",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"private": true, "private": true,
"license": "AGPL-3.0", "license": "AGPL-3.0",
"scripts": { "scripts": {

8
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@documenso/root", "name": "@documenso/root",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@documenso/root", "name": "@documenso/root",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"workspaces": [ "workspaces": [
"apps/*", "apps/*",
"packages/*" "packages/*"
@@ -77,7 +77,7 @@
}, },
"apps/marketing": { "apps/marketing": {
"name": "@documenso/marketing", "name": "@documenso/marketing",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@documenso/assets": "*", "@documenso/assets": "*",
@@ -438,7 +438,7 @@
}, },
"apps/web": { "apps/web": {
"name": "@documenso/web", "name": "@documenso/web",
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"dependencies": { "dependencies": {
"@documenso/api": "*", "@documenso/api": "*",

View File

@@ -1,6 +1,6 @@
{ {
"private": true, "private": true,
"version": "1.8.1-rc.3", "version": "1.8.1-rc.4",
"scripts": { "scripts": {
"build": "turbo run build", "build": "turbo run build",
"build:web": "turbo run build --filter=@documenso/web", "build:web": "turbo run build --filter=@documenso/web",

View File

@@ -128,7 +128,7 @@ export const SEAL_DOCUMENT_JOB_DEFINITION = {
const pdfData = await getFile(documentData); const pdfData = await getFile(documentData);
const certificateData = const certificateData =
document.team?.teamGlobalSettings?.includeSigningCertificate ?? true (document.team?.teamGlobalSettings?.includeSigningCertificate ?? true)
? await getCertificatePdf({ ? await getCertificatePdf({
documentId, documentId,
language: document.documentMeta?.language, language: document.documentMeta?.language,
@@ -167,10 +167,10 @@ export const SEAL_DOCUMENT_JOB_DEFINITION = {
const pdfBytes = await pdfDoc.save(); const pdfBytes = await pdfDoc.save();
const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) }); const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });
const { name, ext } = path.parse(document.title); const { name } = path.parse(document.title);
const documentData = await putPdfFile({ const documentData = await putPdfFile({
name: `${name}_signed${ext}`, name: `${name}_signed.pdf`,
type: 'application/pdf', type: 'application/pdf',
arrayBuffer: async () => Promise.resolve(pdfBuffer), arrayBuffer: async () => Promise.resolve(pdfBuffer),
}); });

View File

@@ -101,7 +101,7 @@ export const sealDocument = async ({
const pdfData = await getFile(documentData); const pdfData = await getFile(documentData);
const certificateData = const certificateData =
document.team?.teamGlobalSettings?.includeSigningCertificate ?? true (document.team?.teamGlobalSettings?.includeSigningCertificate ?? true)
? await getCertificatePdf({ ? await getCertificatePdf({
documentId, documentId,
language: document.documentMeta?.language, language: document.documentMeta?.language,
@@ -136,10 +136,10 @@ export const sealDocument = async ({
const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) }); const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });
const { name, ext } = path.parse(document.title); const { name } = path.parse(document.title);
const { data: newData } = await putPdfFile({ const { data: newData } = await putPdfFile({
name: `${name}_signed${ext}`, name: `${name}_signed.pdf`,
type: 'application/pdf', type: 'application/pdf',
arrayBuffer: async () => Promise.resolve(pdfBuffer), arrayBuffer: async () => Promise.resolve(pdfBuffer),
}); });

View File

@@ -114,8 +114,14 @@ export const sendDocument = async ({
formValues: document.formValues as Record<string, string | number | boolean>, formValues: document.formValues as Record<string, string | number | boolean>,
}); });
let fileName = document.title;
if (!document.title.endsWith('.pdf')) {
fileName = `${document.title}.pdf`;
}
const newDocumentData = await putPdfFile({ const newDocumentData = await putPdfFile({
name: document.title, name: fileName,
type: 'application/pdf', type: 'application/pdf',
arrayBuffer: async () => Promise.resolve(prefilled), arrayBuffer: async () => Promise.resolve(prefilled),
}); });

View File

@@ -33,6 +33,10 @@ export const putPdfFile = async (file: File) => {
}); });
} }
if (!file.name.endsWith('.pdf')) {
file.name = `${file.name}.pdf`;
}
const { type, data } = await putFile(file); const { type, data } = await putFile(file);
return await createDocumentData({ type, data }); return await createDocumentData({ type, data });