High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(cli): sidecar precedence (#31929)
Jonathan Jogenfors1ba6a5f33853
diff --git a/packages/cli/src/commands/asset.spec.ts b/packages/cli/src/commands/asset.spec.tsindex 7e582039ba..a105d09d40 100644--- a/packages/cli/src/commands/asset.spec.ts+++ b/packages/cli/src/commands/asset.spec.ts@@ -385,8 +385,7 @@ describe('findSidecar', () => {fs.writeFileSync(sidecarPath2, 'xmp data 2');const result = findSidecar(testFilePath);- // Should return the first one found (photo.xmp) based on the order in the code- expect(result).toBe(sidecarPath1);+ expect(result).toBe(sidecarPath2);});it('should return undefined when no sidecar file exists', () => {diff --git a/packages/cli/src/commands/asset.ts b/packages/cli/src/commands/asset.tsindex 6aab96dc30..ac6f5eb990 100644--- a/packages/cli/src/commands/asset.ts+++ b/packages/cli/src/commands/asset.ts@@ -445,8 +445,8 @@ export const findSidecar = (filepath: string): string | undefined => {const assetPath = path.parse(filepath);const noExtension = path.join(assetPath.dir, assetPath.name);- // XMP sidecars can come in two filename formats. For a photo named photo.ext, the filenames are photo.ext.xmp and photo.xmp- for (const sidecarPath of [`${noExtension}.xmp`, `${filepath}.xmp`]) {+ // Prefer photo.ext.xmp over photo.xmp, matching the server's sidecar precedence.+ for (const sidecarPath of [`${filepath}.xmp`, `${noExtension}.xmp`]) {if (existsSync(sidecarPath)) {return sidecarPath;}