Added check to prevent the addition of empty undefined / null as buffers

This commit is contained in:
Alexander Cerutti
2021-09-28 00:56:30 +02:00
parent 770a5e780b
commit 56bb7b9a16

View File

@@ -265,16 +265,17 @@ export default class PKPass extends Bundle {
/** /**
* Allows adding a new asset inside the pass / bundle; * Allows adding a new asset inside the pass / bundle;
* If an empty buffer is passed, it won't be added to
* the bundle.
* *
* @param pathName * @param pathName
* @param buffer * @param buffer
*/ */
public addBuffer(pathName: string, buffer: Buffer): void { public addBuffer(pathName: string, buffer: Buffer): void {
/** if (!buffer) {
* @TODO implement return;
* @TODO exclude pass.json, manifest, signature files }
*/
if (/manifest|signature/.test(pathName)) { if (/manifest|signature/.test(pathName)) {
return; return;