mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 22:25:24 +00:00
Fixed thumbnailFile and logoFile absence
This commit is contained in:
@@ -228,9 +228,11 @@ export const pass = functions.https.onRequest(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { thumbnailFile, logoFile } = request.body;
|
||||||
|
|
||||||
// Downloading thumbnail and logo files from Firebase Storage and adding to pass
|
// Downloading thumbnail and logo files from Firebase Storage and adding to pass
|
||||||
if (newPass.type == "generic" || newPass.type == "eventTicket") {
|
if (newPass.type == "generic" || newPass.type == "eventTicket") {
|
||||||
const thumbnailFile = request.body.thumbnailFile;
|
if (thumbnailFile) {
|
||||||
const tempPath1 = path.join(os.tmpdir(), thumbnailFile);
|
const tempPath1 = path.join(os.tmpdir(), thumbnailFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -240,18 +242,23 @@ export const pass = functions.https.onRequest(
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
let buffer = Buffer.alloc(0);
|
let buffer = Buffer.alloc(0);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buffer = fs.readFileSync(tempPath1);
|
buffer = fs.readFileSync(tempPath1);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
newPass.addBuffer("thumbnail.png", buffer);
|
newPass.addBuffer("thumbnail.png", buffer);
|
||||||
newPass.addBuffer("thumbnail@2x.png", buffer);
|
newPass.addBuffer("thumbnail@2x.png", buffer);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const logoFile = request.body.logoFile;
|
if (logoFile) {
|
||||||
const tempPath2 = path.join(os.tmpdir(), logoFile);
|
const tempPath2 = path.join(os.tmpdir(), logoFile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await storageRef
|
await storageRef
|
||||||
.file(`logos/${logoFile}`)
|
.file(`logos/${logoFile}`)
|
||||||
@@ -269,6 +276,7 @@ export const pass = functions.https.onRequest(
|
|||||||
|
|
||||||
newPass.addBuffer("logo.png", buffer);
|
newPass.addBuffer("logo.png", buffer);
|
||||||
newPass.addBuffer("logo@2x.png", buffer);
|
newPass.addBuffer("logo@2x.png", buffer);
|
||||||
|
}
|
||||||
|
|
||||||
const bufferData = newPass.getAsBuffer();
|
const bufferData = newPass.getAsBuffer();
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user