mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 17:52:38 +00:00
Only fix stub if we actually found one.
This commit is contained in:
committed by
Victor Losada Hernandez
parent
2050028484
commit
bd6eb816f2
@@ -47,7 +47,7 @@ const api = {
|
|||||||
console.warn(err);
|
console.warn(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
stub = stub?.toObject() || {};
|
stub = stub?.toObject();
|
||||||
|
|
||||||
// If there is a google id, try to find the google brew
|
// If there is a google id, try to find the google brew
|
||||||
if(!stubOnly && (googleId || stub?.googleId)) {
|
if(!stubOnly && (googleId || stub?.googleId)) {
|
||||||
@@ -77,9 +77,11 @@ If you believe you should have access to this brew, ask the file owner to invite
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clean up brew: fill in missing fields with defaults / fix old invalid values
|
// Clean up brew: fill in missing fields with defaults / fix old invalid values
|
||||||
stub.tags = stub.tags || undefined; // Clear empty strings
|
if(stub) {
|
||||||
stub.renderer = stub.renderer || undefined; // Clear empty strings
|
stub.tags = stub.tags || undefined; // Clear empty strings
|
||||||
stub = _.defaults(stub, DEFAULT_BREW_LOAD); // Fill in blank fields
|
stub.renderer = stub.renderer || undefined; // Clear empty strings
|
||||||
|
stub = _.defaults(stub, DEFAULT_BREW_LOAD); // Fill in blank fields
|
||||||
|
}
|
||||||
|
|
||||||
req.brew = stub;
|
req.brew = stub;
|
||||||
next();
|
next();
|
||||||
|
|||||||
Reference in New Issue
Block a user