Skip to content

Commit

Permalink
fix: Maximum call size no longer exceeded for large libraries
Browse files Browse the repository at this point in the history
Closes #231
  • Loading branch information
Frank Steiler committed Jul 3, 2023
1 parent 9e7af62 commit 1d0f5e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/lib/icloud/icloud-photos/icloud-photos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,10 @@ export class iCloudPhotos extends EventEmitter {
[allRecords, expectedNumberOfRecords] = await this.fetchAllPictureRecordsForZone(QueryBuilder.Zones.Primary, parentId);

// Merging assets of shared library, if available
if (this.auth.sharedLibraryAvailable()) {
if (this.auth.sharedLibraryAvailable() && typeof parentId === 'undefined') { // only fetch shared album records if no parentId is specified, since icloud api does not yet support shared records in albums
this.logger.debug(`Fetching all picture records for album ${parentId === undefined ? `All photos` : parentId} for shared zone`);
const [sharedRecords, sharedExpectedCount] = await this.fetchAllPictureRecordsForZone(QueryBuilder.Zones.Shared);
allRecords.push(...sharedRecords);
allRecords = [...allRecords, ...sharedRecords];
expectedNumberOfRecords += sharedExpectedCount;
}
} catch (err) {
Expand Down
1 change: 1 addition & 0 deletions app/src/lib/photos-library/model/file-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const EXT = {
'com.nikon.raw-image': `nef`,
'com.olympus.raw-image': `orf`,
'public.avi': `avi`,
'com.adobe.pdf': `pdf`,
};

/**
Expand Down
8 changes: 4 additions & 4 deletions app/test/unit/photos-library.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe(`Load state`, () => {
"Aa7_yox97ecSUNmVw0xP4YzIDDKf.jpeg": Buffer.from([1, 1, 1, 1]),
"AaGv15G3Cp9LPMQQfFZiHRryHgjU.jpeg": Buffer.from([1, 1, 1, 1, 1]),
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf": Buffer.from([1, 1, 1, 1, 1, 1]), // No file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.pdf": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.xyz": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpF-f": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file name
},
},
Expand All @@ -135,7 +135,7 @@ describe(`Load state`, () => {
"Aa7_yox97ecSUNmVw0xP4YzIDDKf.jpeg": Buffer.from([1, 1, 1, 1]),
"AaGv15G3Cp9LPMQQfFZiHRryHgjU.jpeg": Buffer.from([1, 1, 1, 1, 1]),
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf": Buffer.from([1, 1, 1, 1, 1, 1]), // No file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.pdf": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.xyz": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpF-f": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file name
},
},
Expand All @@ -148,13 +148,13 @@ describe(`Load state`, () => {
"deFEyox97ecdknADe0xP4YzIDDKf.jpeg": Buffer.from([1, 1, 1, 1]),
"deFEeee3Cp9LPMQQfFZiHRryHgjU.jpeg": Buffer.from([1, 1, 1, 1, 1]),
"kkiceenhGFNWjAeqKEkB_SNLNpFf.jpeg": Buffer.from([1, 1, 1, 1, 1, 1]),
"Aah0dUnasdfejAeqKEkB_SNLNpFf.pdf": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnasdfejAeqKEkB_SNLNpFf.xyz": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
},
[sharedAssetDir]: {
"Aa7_yox97ecSUNmVw0xP4YzIDDKf.jpeg": Buffer.from([1, 1, 1, 1]),
"AaGv15G3Cp9LPMQQfFZiHRryHgjU.jpeg": Buffer.from([1, 1, 1, 1, 1]),
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf": Buffer.from([1, 1, 1, 1, 1, 1]), // No file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.pdf": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpFf.xyz": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file extension
"Aah0dUnhGFNWjAeqKEkB_SNLNpF-f": Buffer.from([1, 1, 1, 1, 1, 1]), // Invalid file name
},
},
Expand Down

0 comments on commit 1d0f5e9

Please sign in to comment.