Skip to content

Commit

Permalink
Merge pull request #510 from BlueBubblesApp/development
Browse files Browse the repository at this point in the history
fix: live photo edge cases
  • Loading branch information
zlshames authored Mar 30, 2023
2 parents 665f4b7 + c5c9421 commit a16e69a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class AttachmentSerializer {
if (!isForNotification) {
// Get the path for a possible live photo
const ext = fPath.split(".").pop();
const livePath = ext ? fPath.replace(`.${ext}`, ".mov") : `${fPath}.mov`;
const livePath = ext !== fPath ? fPath.replace(`.${ext}`, ".mov") : `${fPath}.mov`;

output = {
...output,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ export class AttachmentRouter {

// Replace the extension with .mov (if there is one). Otherwise just append .mov
const ext = aPath.split(".").pop();
const livePath = ext ? aPath.replace(`.${ext}`, ".mov") : `${aPath}.mov`;
if (!fs.existsSync(livePath)) throw new NotFound({ error: "Live photo does not exist for this attachment!" });
const livePath = ext !== aPath ? aPath.replace(`.${ext}`, ".mov") : `${aPath}.mov`;
if (aPath.endsWith('.mov') || !fs.existsSync(livePath))
throw new NotFound({ error: "Live photo does not exist for this attachment!" });

return new FileStream(ctx, livePath, "video/quicktime").send();
}
Expand Down

0 comments on commit a16e69a

Please sign in to comment.