Skip to content

Commit

Permalink
fix(core): change how File is handled in map
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Nov 12, 2021
1 parent 03b6058 commit 57df4ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/core/src/lib/map/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,13 @@ Original error: ${originalError}`;
)(sourceObj);

// if null/undefined
// if isDate
// if isDate, isFile
// if metadata is null, treat as-is
if (
mapInitializedValue == null ||
mapInitializedValue instanceof Date ||
Object.prototype.toString.call(mapInitializedValue).slice(8, -1) ===
'File' ||
isMetadataNull
) {
setMember(() => mapInitializedValue);
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/lib/utils/is-file-constructor.util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export function isFileConstructor(value: unknown): boolean {
return value === File;
const constructorName = value['prototype']
? value['prototype'].constructor.name
: value['name'];
return constructorName === 'File';
}

0 comments on commit 57df4ad

Please sign in to comment.