File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/runtime/src/enhancements/node Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,9 @@ class EncryptedHandler extends DefaultPrismaProxyHandler {
141
141
142
142
const shouldDecrypt = fieldInfo . attributes ?. find ( ( attr ) => attr . name === '@encrypted' ) ;
143
143
if ( shouldDecrypt ) {
144
+ // Don't decrypt null, undefined or empty string values
145
+ if ( ! entityData [ field ] ) return ;
146
+
144
147
entityData [ field ] = await this . decrypt ( fieldInfo , entityData [ field ] ) ;
145
148
}
146
149
}
@@ -151,7 +154,7 @@ class EncryptedHandler extends DefaultPrismaProxyHandler {
151
154
field : async ( field , _action , data , context ) => {
152
155
// Don't encrypt null, undefined or empty string values
153
156
if ( ! data ) return ;
154
-
157
+
155
158
const encAttr = field . attributes ?. find ( ( attr ) => attr . name === '@encrypted' ) ;
156
159
if ( encAttr && field . type === 'String' ) {
157
160
context . parent [ field . name ] = await this . encrypt ( field , data ) ;
You can’t perform that action at this time.
0 commit comments