mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-29 17:42:38 +00:00
Handle Old Google Drive links that used 10-char shareID
When the Homebrewery was first made, editIds and ShareIds only had 10 characters. We later increased this to 12. However this means some old, old Google Drive links (in the form of `googleId + editId`) were being split incorrectly because they assumed the newer 12-char length, accidentally cutting the last 2 chars from the googleId.
This commit is contained in:
@@ -324,8 +324,8 @@ app.get('/share/:id', asyncHandler(getBrew('share')), asyncHandler(async (req, r
|
||||
};
|
||||
|
||||
if(req.params.id.length > 12 && !brew._id) {
|
||||
const googleId = req.params.id.slice(0, -12);
|
||||
const shareId = req.params.id.slice(-12);
|
||||
const googleId = brew.googleId;
|
||||
const shareId = brew.shareId;
|
||||
await GoogleActions.increaseView(googleId, shareId, 'share', brew)
|
||||
.catch((err)=>{next(err);});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user