Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 committed Jan 2, 2025
1 parent 4aad83c commit 93d482a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/runtime/src/enhancements/node/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ class EncryptedHandler extends DefaultPrismaProxyHandler {
const realModel = this.queryUtils.getDelegateConcreteModel(model, entityData);

for (const field of getModelFields(entityData)) {
// Don't decrypt null, undefined or empty string values
if (!entityData[field]) continue;

const fieldInfo = await resolveField(this.options.modelMeta, realModel, field);
if (!fieldInfo) {
continue;
Expand All @@ -153,9 +156,6 @@ class EncryptedHandler extends DefaultPrismaProxyHandler {
} else {
const shouldDecrypt = fieldInfo.attributes?.find((attr) => attr.name === '@encrypted');
if (shouldDecrypt) {
// Don't decrypt null, undefined or empty string values
if (!entityData[field]) continue;

try {
entityData[field] = await this.decrypt(fieldInfo, entityData[field]);
} catch (error) {
Expand Down

0 comments on commit 93d482a

Please sign in to comment.