0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +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:
Trevor Buckner
2023-07-06 00:10:07 -04:00
parent 84496f51ba
commit 6344eaa17d
3 changed files with 13 additions and 8 deletions

View File

@@ -100,12 +100,12 @@ const GoogleActions = {
const drive = googleDrive.drive({ version: 'v3', auth });
const fileList = [];
let NextPageToken = "";
let NextPageToken = '';
do {
const obj = await drive.files.list({
pageSize : 1000,
pageToken : NextPageToken || "",
pageToken : NextPageToken || '',
fields : 'nextPageToken, files(id, name, description, createdTime, modifiedTime, properties)',
q : 'mimeType != \'application/vnd.google-apps.folder\' and trashed = false'
})
@@ -243,9 +243,9 @@ const GoogleActions = {
if(obj) {
if(accessType == 'edit' && obj.data.properties.editId != accessId){
throw ('Edit ID does not match');
throw ({ message: 'Edit ID does not match' });
} else if(accessType == 'share' && obj.data.properties.shareId != accessId){
throw ('Share ID does not match');
throw ({ message: 'Share ID does not match' });
}
const file = await drive.files.get({