Skip to content

Commit 7578702

Browse files
fix(files): suppress filename in share previews for email/sso, not just password
1 parent 3836f0a commit 7578702

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

apps/sim/app/f/[token]/opengraph-image.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ export const size = {
1111

1212
/**
1313
* Social-preview card for a shared file. Public shares show the file name +
14-
* provenance; password-protected (and unknown) shares stay generic so the
15-
* filename never leaks pre-auth.
14+
* provenance; protected (password / email / SSO) and unknown shares stay generic
15+
* so the filename never leaks pre-auth.
1616
*/
1717
export default async function Image({ params }: { params: Promise<{ token: string }> }) {
1818
const { token } = await params
1919
const resolved = await resolveActiveShareByToken(token)
2020

21-
if (!resolved || resolved.share.authType === 'password') {
21+
if (!resolved || resolved.share.authType !== 'public') {
2222
return createLandingOgImage({
2323
eyebrow: 'Shared file',
24-
title: 'Password-protected file',
25-
subtitle: 'Enter the password to view this file',
24+
title: 'Protected file',
25+
subtitle: 'Authentication is required to view this file',
2626
})
2727
}
2828

apps/sim/app/f/[token]/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ interface PublicFilePageProps {
3030

3131
/**
3232
* Social-preview metadata. Public shares unfurl with the file name + provenance;
33-
* password-protected shares stay deliberately generic so the filename never leaks
34-
* before the password is entered. Always `noindex`.
33+
* any protected share (password / email / SSO) stays deliberately generic so the
34+
* filename never leaks before the visitor authenticates. Always `noindex`.
3535
*/
3636
export async function generateMetadata({ params }: PublicFilePageProps): Promise<Metadata> {
3737
const { token } = await params
@@ -42,9 +42,9 @@ export async function generateMetadata({ params }: PublicFilePageProps): Promise
4242

4343
let title: string
4444
let description: string
45-
if (resolved.share.authType === 'password') {
45+
if (resolved.share.authType !== 'public') {
4646
title = 'Shared file'
47-
description = 'This file is password-protected.'
47+
description = 'Authentication is required to view this file.'
4848
} else {
4949
title = resolved.file.originalName
5050
description =

apps/sim/lib/core/security/deployment-auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export interface DeploymentAuthResult {
5353
/**
5454
* Shared password/email/SSO gate for deployed resources. The `cookiePrefix`
5555
* selects the auth cookie (`${cookiePrefix}_auth_${id}`) and the rate-limit
56-
* namespace so chat deployments and public file shares share one code path. File
57-
* shares only ever use `'public'` / `'password'`, a strict subset of chat's modes.
56+
* namespace so chat deployments and public file shares share one code path. Both
57+
* support all four modes: `'public'`, `'password'`, `'email'`, and `'sso'`.
5858
*/
5959
export async function validateDeploymentAuth(
6060
requestId: string,

0 commit comments

Comments
 (0)