Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): asset count on meta tag of shared links #9107

Merged

Conversation

nghduc97
Copy link
Contributor

@nghduc97 nghduc97 commented Apr 27, 2024

Fixed #8605

@@ -185,7 +185,7 @@ export class SharedLinkService {

const sharedLink = await this.findOrFail(auth.sharedLink.userId, auth.sharedLink.id);
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
const assetCount = sharedLink.assets.length ?? sharedLink.album?.assets.length ?? 0;
const assetCount = sharedLink.assets.length || sharedLink.album?.assets.length || 0;
Copy link
Contributor Author

@nghduc97 nghduc97 Apr 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When share link is a whole album, sharedLink.assets.length is 0 and sharedLink.album?.assets.length is the real asset count. But 0 ?? 10 ?? 0 === 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danieldietzler see another reason why || is better than ??. Just causes headaches most of the time imo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha! I think there are valid scenarios in which you specifically don't want || but yeah, by default I see your point

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. We should probably add an e2e test for this. Is that something you want to take a look at? Essentially, make an http request to /share/<key> and make sure the resulting html returns the correct meta tags. We could add this in e2e/src/api/specs/shared-link.e2e-spec.ts.

@nghduc97
Copy link
Contributor Author

Good catch. We should probably add an e2e test for this. Is that something you want to take a look at? Essentially, make an http request to /share/<key> and make sure the resulting html returns the correct meta tags. We could add this in e2e/src/api/specs/shared-link.e2e-spec.ts.

sure, I'll add one

@jrasm91 jrasm91 merged commit 833a781 into immich-app:main Apr 27, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong photo count in share pages, duplicated <meta> tags
3 participants