From 366fcf0bedff863c24f822249e1cbf3c03cf1684 Mon Sep 17 00:00:00 2001 From: Ivan Kristianto Date: Sat, 12 Feb 2022 12:46:06 +0700 Subject: [PATCH] Fix nginx/certificates search query --- backend/internal/certificate.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js index 351b9b3d..7c8fddee 100644 --- a/backend/internal/certificate.js +++ b/backend/internal/certificate.js @@ -388,7 +388,7 @@ const internalCertificate = { zipFiles(source, out) { const archive = archiver('zip', { zlib: { level: 9 } }); const stream = fs.createWriteStream(out); - + return new Promise((resolve, reject) => { source .map((fl) => { @@ -399,7 +399,7 @@ const internalCertificate = { archive .on('error', (err) => reject(err)) .pipe(stream); - + stream.on('close', () => resolve()); archive.finalize(); }); @@ -477,7 +477,7 @@ const internalCertificate = { // Query is used for searching if (typeof search_query === 'string') { query.where(function () { - this.where('name', 'like', '%' + search_query + '%'); + this.where('nice_name', 'like', '%' + search_query + '%'); }); } @@ -1140,7 +1140,7 @@ const internalCertificate = { if (domains.length === 0) { throw new error.InternalValidationError('No domains provided'); } - + // Create a test challenge file const testChallengeDir = '/data/letsencrypt-acme-challenge/.well-known/acme-challenge'; const testChallengeFile = testChallengeDir + '/test-challenge'; @@ -1215,7 +1215,7 @@ const internalCertificate = { // Remove the test challenge file fs.unlinkSync(testChallengeFile); - + return results; } };