From 48b2047a845d4361888c1c3d8ca5ea2994d0254c Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 22 Jun 2026 20:21:44 +0800 Subject: [PATCH 1/3] feat(share): secure share info API and fix wrong password feedback --- packages/api/src/public-share.ts | 18 +- packages/api/src/share.test.ts | 59 ++++ .../webui/components/public-share-manager.tsx | 289 +++++++++++------- packages/webui/routes/share/$shareId.tsx | 34 --- .../routes/share/$shareId/files/$fileId.tsx | 27 +- .../share/$shareId/folders/$folderId.tsx | 26 +- .../webui/routes/share/$shareId/index.tsx | 26 +- 7 files changed, 252 insertions(+), 227 deletions(-) diff --git a/packages/api/src/public-share.ts b/packages/api/src/public-share.ts index 4487d3cc..0f648740 100644 --- a/packages/api/src/public-share.ts +++ b/packages/api/src/public-share.ts @@ -37,8 +37,10 @@ const sharedChildrenRequestSchema = paginationParamsSchema.extend({ const route = app .get('/shares/:shareId/info', async (c) => { const shareId = c.req.param('shareId') + const password = c.req.header('x-share-password') try { const shareLink = await shareService.getShareLink(shareId) + await shareService.verifyPublicAccess(shareLink.rootFolderId, password) return c.json({ id: shareLink.id, name: shareLink.name, @@ -52,7 +54,21 @@ const route = app defaultSortOrder: shareLink.defaultSortOrder, }) } catch (err) { - return c.json({ error: (err as Error).message }, 404) + const msg = (err as Error).message + if (msg === 'Invalid password for share link') { + return c.json({ error: 'Unauthorized' }, 401) + } + if (msg === 'Share link has expired' || msg === 'Share link is disabled') { + return c.json({ error: msg }, 403) + } + if ( + msg === 'Share link not found' || + msg === 'Share link not found for this asset' || + msg === 'Asset is not shared' + ) { + return c.json({ error: msg }, 404) + } + return c.json({ error: msg }, 500) } }) .get('/shares/:shareId/fields', async (c) => { diff --git a/packages/api/src/share.test.ts b/packages/api/src/share.test.ts index a5f84db8..93d498e9 100644 --- a/packages/api/src/share.test.ts +++ b/packages/api/src/share.test.ts @@ -57,15 +57,74 @@ describe('Share API', () => { createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), }) + vi.spyOn(shareService, 'verifyPublicAccess').mockResolvedValue({ + id: 'share1', + name: 'Public Share', + rootFolderId: 'folder1', + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } as any) const res = await app.request('/shares/share1/info', { method: 'GET', + headers: { 'x-share-password': 'pass' }, }) expect(res.status).toBe(200) const body = await res.json() expect(body.name).toBe('Public Share') expect(body.hasPassword).toBe(true) + expect(shareService.verifyPublicAccess).toHaveBeenCalledWith('folder1', 'pass') + }) + + test('Unauthorized', async () => { + vi.spyOn(shareService, 'getShareLink').mockResolvedValue({ + id: 'share1', + name: 'Public Share', + isDisabled: false, + isExpired: false, + hasPassword: true, + rootFolderId: 'folder1', + projectId: 'project1', + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }) + vi.spyOn(shareService, 'verifyPublicAccess').mockRejectedValue( + new Error('Invalid password for share link'), + ) + + const res = await app.request('/shares/share1/info', { + method: 'GET', + headers: { 'x-share-password': 'wrong' }, + }) + + expect(res.status).toBe(401) + const body = await res.json() + expect(body.error).toBe('Unauthorized') + }) + + test('Expired/Disabled', async () => { + vi.spyOn(shareService, 'getShareLink').mockResolvedValue({ + id: 'share1', + name: 'Public Share', + isDisabled: false, + isExpired: false, + hasPassword: true, + rootFolderId: 'folder1', + projectId: 'project1', + createdAt: new Date().toISOString(), + updatedAt: new Date().toISOString(), + }) + vi.spyOn(shareService, 'verifyPublicAccess').mockRejectedValue( + new Error('Share link has expired'), + ) + + const res = await app.request('/shares/share1/info', { + method: 'GET', + }) + + expect(res.status).toBe(403) + const body = await res.json() + expect(body.error).toBe('Share link has expired') }) }) diff --git a/packages/webui/components/public-share-manager.tsx b/packages/webui/components/public-share-manager.tsx index efbc9b83..7a1295f9 100644 --- a/packages/webui/components/public-share-manager.tsx +++ b/packages/webui/components/public-share-manager.tsx @@ -21,48 +21,81 @@ import type { Annotation } from '@/ui/types' import { useNavigate } from '@tanstack/react-router' interface PublicShareManagerProps { - shareInfo: { - id: string - name: string - expireAt: string | null - isDisabled: boolean - isExpired: boolean - hasPassword: boolean - rootFolderId: string - projectId: string - viewMode?: string | null - defaultSortOrder?: string | null - } + shareId: string initialFolderId?: string initialFileId?: string startTime?: number } +interface PublicShareInfo { + id: string + name: string + expireAt: string | null + isDisabled: boolean + isExpired: boolean + hasPassword: boolean + rootFolderId: string + projectId: string + viewMode?: string | null + defaultSortOrder?: string | null +} + export function PublicShareManager({ - shareInfo, + shareId, initialFolderId, initialFileId, startTime, }: PublicShareManagerProps) { const navigate = useNavigate() const [password, setPassword] = useState(() => { - return localStorage.getItem(`share_pwd_${shareInfo.id}`) || '' + return localStorage.getItem(`share_pwd_${shareId}`) || '' }) const [passwordInput, setPasswordInput] = useState('') - const [isPasswordValid, setIsPasswordValid] = useState(!shareInfo.hasPassword || !!password) - const currentFolderId = initialFolderId || shareInfo.rootFolderId + const { + data: shareInfo, + error: shareInfoError, + isLoading: isShareInfoLoading, + } = useQuery({ + queryKey: ['share-info', shareId, password], + queryFn: async () => { + const res = await client.api.shares[':shareId'].info.$get( + { + param: { shareId }, + }, + { + headers: { + 'x-share-password': password, + }, + }, + ) + if (res.status === 401) { + throw new Error('Unauthorized') + } + if (res.status === 403) { + const body = (await res.json()) as { error?: string } + throw new Error(body.error || 'Forbidden') + } + if (!res.ok) { + throw new Error('Failed to fetch share info') + } + return (await res.json()) as unknown as PublicShareInfo + }, + retry: false, + }) + + const currentFolderId = initialFolderId || shareInfo?.rootFolderId const viewingFileId = initialFileId || null const [ancestorFolders, setAncestorFolders] = useState([]) // Fetch ancestors for breadcrumb const { data: folderInfo } = useQuery({ - queryKey: ['public-share-folder', shareInfo.id, currentFolderId, password], + queryKey: ['public-share-folder', shareId, currentFolderId, password], queryFn: async () => { const res = await client.api.shares[':shareId'].files[':fileId'].$get( { - param: { shareId: shareInfo.id, fileId: currentFolderId }, + param: { shareId, fileId: currentFolderId! }, }, { headers: { @@ -73,11 +106,11 @@ export function PublicShareManager({ if (res.status === 401) throw new Error('Unauthorized') return (await res.json()) as unknown as AssetInfo }, - enabled: isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled, + enabled: !!shareInfo && !!currentFolderId, }) useEffect(() => { - if (folderInfo?.ancestorFolders) { + if (folderInfo?.ancestorFolders && shareInfo) { // Filter ancestors to only those within the share root const rootIndex = folderInfo.ancestorFolders.findIndex((f) => f.id === shareInfo.rootFolderId) if (rootIndex !== -1) { @@ -86,7 +119,7 @@ export function PublicShareManager({ setAncestorFolders([]) } } - }, [folderInfo, shareInfo.rootFolderId, currentFolderId]) + }, [folderInfo, shareInfo, currentFolderId]) const [selectedIds, setSelectedIds] = useState>(new Set()) const [rightSidebarWidth, setRightSidebarWidth] = useState(360) @@ -103,11 +136,11 @@ export function PublicShareManager({ isFetchingNextPage: isFetchingNextFoldersPage, error: foldersError, } = useInfiniteQuery({ - queryKey: ['public-share-children', shareInfo.id, currentFolderId, 'folder', password], + queryKey: ['public-share-children', shareId, currentFolderId, 'folder', password], queryFn: async ({ pageParam }) => { const res = await client.api.shares[':shareId'].folders[':folderId'].children.$get( { - param: { shareId: shareInfo.id, folderId: currentFolderId }, + param: { shareId, folderId: currentFolderId! }, query: { assetType: 'folder', after: pageParam as string, @@ -123,7 +156,7 @@ export function PublicShareManager({ if (res.status === 403) throw new Error('Expired') return (await res.json()) as unknown as AssetInfoPaginatedList }, - enabled: isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled, + enabled: !!shareInfo && !!currentFolderId, initialPageParam: '', getNextPageParam: (lastPage) => lastPage.pageInfo?.cursor || undefined, retry: false, @@ -135,11 +168,11 @@ export function PublicShareManager({ hasNextPage: hasNextPageFiles, isFetchingNextPage: isFetchingNextFilesPage, } = useInfiniteQuery({ - queryKey: ['public-share-children', shareInfo.id, currentFolderId, 'file', password], + queryKey: ['public-share-children', shareId, currentFolderId, 'file', password], queryFn: async ({ pageParam }) => { const res = await client.api.shares[':shareId'].folders[':folderId'].children.$get( { - param: { shareId: shareInfo.id, folderId: currentFolderId }, + param: { shareId, folderId: currentFolderId! }, query: { assetType: 'file', after: pageParam as string, @@ -155,18 +188,18 @@ export function PublicShareManager({ if (res.status === 403) throw new Error('Expired') return (await res.json()) as unknown as AssetInfoPaginatedList }, - enabled: isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled, + enabled: !!shareInfo && !!currentFolderId, initialPageParam: '', getNextPageParam: (lastPage) => lastPage.pageInfo?.cursor || undefined, retry: false, }) const { data: publicFields } = useQuery({ - queryKey: ['public-share-fields', shareInfo.id, password], + queryKey: ['public-share-fields', shareId, password], queryFn: async () => { const res = await client.api.shares[':shareId'].fields.$get( { - param: { shareId: shareInfo.id }, + param: { shareId }, }, { headers: { @@ -177,15 +210,15 @@ export function PublicShareManager({ if (res.status === 401) throw new Error('Unauthorized') return (await res.json()) as unknown as FieldInfo[] }, - enabled: isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled, + enabled: !!shareInfo, }) const { data: viewingFileData, isLoading: isViewingFileLoading } = useQuery({ - queryKey: ['public-share-file', shareInfo.id, viewingFileId, password], + queryKey: ['public-share-file', shareId, viewingFileId, password], queryFn: async () => { const res = await client.api.shares[':shareId'].files[':fileId'].$get( { - param: { shareId: shareInfo.id, fileId: viewingFileId! }, + param: { shareId, fileId: viewingFileId! }, }, { headers: { @@ -196,16 +229,15 @@ export function PublicShareManager({ if (res.status === 401) throw new Error('Unauthorized') return (await res.json()) as unknown as AssetInfo }, - enabled: !!viewingFileId && isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled, + enabled: !!viewingFileId && !!shareInfo, }) useEffect(() => { if (foldersError?.message === 'Unauthorized') { - setIsPasswordValid(false) setPassword('') - localStorage.removeItem(`share_pwd_${shareInfo.id}`) + localStorage.removeItem(`share_pwd_${shareId}`) } - }, [foldersError, shareInfo.id]) + }, [foldersError, shareId]) const folders = useMemo( () => foldersData?.pages.flatMap((page) => page.data ?? []) ?? [], @@ -226,21 +258,20 @@ export function PublicShareManager({ const handlePasswordSubmit = (e: React.FormEvent) => { e.preventDefault() setPassword(passwordInput) - setIsPasswordValid(true) - localStorage.setItem(`share_pwd_${shareInfo.id}`, passwordInput) + localStorage.setItem(`share_pwd_${shareId}`, passwordInput) } const handleItemDoubleClick = (item: AssetInfo) => { if (item.type === 'folder' || item.targetType === 'folder') { navigate({ to: '/share/$shareId/folders/$folderId', - params: { shareId: shareInfo.id, folderId: item.id! }, + params: { shareId, folderId: item.id! }, }) } else { navigate({ to: '/share/$shareId/files/$fileId', params: { - shareId: shareInfo.id, + shareId, fileId: item.versionStack ? item.versionStack.id : item.id!, }, }) @@ -249,17 +280,18 @@ export function PublicShareManager({ } const handleBreadcrumbClick = (folderId: string) => { + if (!shareInfo) return const targetId = folderId === 'root' ? shareInfo.rootFolderId : folderId if (targetId === shareInfo.rootFolderId) { navigate({ to: '/share/$shareId', - params: { shareId: shareInfo.id }, + params: { shareId }, }) } else { navigate({ to: '/share/$shareId/folders/$folderId', - params: { shareId: shareInfo.id, folderId: targetId }, + params: { shareId, folderId: targetId }, }) } setSelectedIds(new Set()) @@ -294,7 +326,7 @@ export function PublicShareManager({ const { setProjectState, clearProjectState } = useTopNavStore() useEffect(() => { - if (isPasswordValid && !shareInfo.isExpired && !shareInfo.isDisabled) { + if (shareInfo && currentFolderId) { const currentFolderName = currentFolderId === shareInfo.rootFolderId ? shareInfo.name @@ -315,7 +347,7 @@ export function PublicShareManager({ }, isRootFolder: currentFolderId === shareInfo.rootFolderId && !viewingFileId, isPublic: true, - shareId: shareInfo.id, + shareId, fileId: viewingFileId || undefined, onFolderClick: handleBreadcrumbClick, isRightSidebarCollapsed, @@ -325,7 +357,6 @@ export function PublicShareManager({ return () => clearProjectState() }, [ - isPasswordValid, shareInfo, currentFolderId, folders, @@ -339,49 +370,73 @@ export function PublicShareManager({ let content - if (shareInfo.isExpired || shareInfo.isDisabled) { + if (isShareInfoLoading && !shareInfoError) { content = ( -
- - -
- -
- Share {shareInfo.isDisabled ? 'Disabled' : 'Expired'} -
- - {shareInfo.isDisabled - ? 'This share link has been disabled by the owner.' - : 'This share link has expired and is no longer accessible.'} - -
+
+
) - } else if (!isPasswordValid) { + } else if (shareInfoError) { + if (shareInfoError.message === 'Unauthorized') { + const isPasswordWrong = password !== '' + content = ( +
+ + +
+ +
+ Password Protected +
+ +
+
+ setPasswordInput(e.target.value)} + autoFocus + /> + {isPasswordWrong && ( +

+ Incorrect password. Please try again. +

+ )} +
+ +
+
+
+
+ ) + } else { + const isExpired = shareInfoError.message.includes('expired') + const isDisabled = shareInfoError.message.includes('disabled') + content = ( +
+ + +
+ +
+ + {isExpired ? 'Share Expired' : isDisabled ? 'Share Disabled' : 'Error'} + +
+ + {shareInfoError.message} + +
+
+ ) + } + } else if (!shareInfo) { content = ( -
- - -
- -
- Password Protected -
- -
- setPasswordInput(e.target.value)} - autoFocus - /> - -
-
-
+
+
) } else { @@ -406,37 +461,39 @@ export function PublicShareManager({ )}
) : ( - { - if (e.metaKey || e.ctrlKey) { - const next = new Set(selectedIds) - if (next.has(item.id!)) next.delete(item.id!) - else next.add(item.id!) - setSelectedIds(next) - } else { - setSelectedIds(new Set([item.id!])) - } - }} - onItemDoubleClick={handleItemDoubleClick} - onSaveField={() => {}} - displayStyle={(shareInfo.viewMode as 'card' | 'list') ?? 'card'} - onClearSelection={() => setSelectedIds(new Set())} - fetchNextFoldersPage={fetchNextFoldersPage} - hasNextFoldersPage={hasNextPageFolders} - isFetchingNextFoldersPage={isFetchingNextFoldersPage} - fetchNextFilesPage={fetchNextFilesPage} - hasNextFilesPage={hasNextPageFiles} - isFetchingNextFilesPage={isFetchingNextFilesPage} - isShareView={true} - isPublic={true} - /> + currentFolderId && ( + { + if (e.metaKey || e.ctrlKey) { + const next = new Set(selectedIds) + if (next.has(item.id!)) next.delete(item.id!) + else next.add(item.id!) + setSelectedIds(next) + } else { + setSelectedIds(new Set([item.id!])) + } + }} + onItemDoubleClick={handleItemDoubleClick} + onSaveField={() => {}} + displayStyle={(shareInfo.viewMode as 'card' | 'list') ?? 'card'} + onClearSelection={() => setSelectedIds(new Set())} + fetchNextFoldersPage={fetchNextFoldersPage} + hasNextFoldersPage={hasNextPageFolders} + isFetchingNextFoldersPage={isFetchingNextFoldersPage} + fetchNextFilesPage={fetchNextFilesPage} + hasNextFilesPage={hasNextPageFiles} + isFetchingNextFilesPage={isFetchingNextFilesPage} + isShareView={true} + isPublic={true} + /> + ) )} {!isRightSidebarCollapsed && ( @@ -457,7 +514,7 @@ export function PublicShareManager({ publicFields={publicFields} onCommentSelect={handleCommentSelect} isPublic={true} - shareId={shareInfo.id} + shareId={shareId} currentTime={currentTime} onTyping={() => { if (videoRef.current) { diff --git a/packages/webui/routes/share/$shareId.tsx b/packages/webui/routes/share/$shareId.tsx index fd8689ca..e51fffe0 100644 --- a/packages/webui/routes/share/$shareId.tsx +++ b/packages/webui/routes/share/$shareId.tsx @@ -1,43 +1,9 @@ -import { client } from '@/ui/api/client' -import { ProjectFolderSkeleton } from '@/ui/components/loading-skeletons' -import { useQuery } from '@tanstack/react-query' import { createFileRoute, Outlet } from '@tanstack/react-router' function ShareLayout() { - const { shareId } = Route.useParams() - - const { - data: shareInfo, - isLoading, - error, - } = useQuery({ - queryKey: ['share-info', shareId], - queryFn: async () => { - const res = await client.api.shares[':shareId'].info.$get({ - param: { shareId }, - }) - if (!res.ok) throw new Error('Failed to fetch share info') - return await res.json() - }, - }) - - if (isLoading) return - - if (error || !shareInfo) - return ( -
- Share not found or inaccessible. -
- ) - return } export const Route = createFileRoute('/share/$shareId')({ component: ShareLayout, - beforeLoad: ({ params: { shareId } }) => { - return { - password: localStorage.getItem(`share_pwd_${shareId}`) || '', - } - }, }) diff --git a/packages/webui/routes/share/$shareId/files/$fileId.tsx b/packages/webui/routes/share/$shareId/files/$fileId.tsx index ab5ca42b..d3098877 100644 --- a/packages/webui/routes/share/$shareId/files/$fileId.tsx +++ b/packages/webui/routes/share/$shareId/files/$fileId.tsx @@ -1,36 +1,11 @@ -import { client } from '@/ui/api/client' import { PublicShareManager } from '@/ui/components/public-share-manager' -import { useQuery } from '@tanstack/react-query' import { createFileRoute } from '@tanstack/react-router' function PublicShareFilePage() { const { shareId, fileId } = Route.useParams() const { start } = Route.useSearch() - const { data: shareInfo } = useQuery({ - queryKey: ['share-info', shareId], - queryFn: async () => { - const res = await client.api.shares[':shareId'].info.$get({ - param: { shareId }, - }) - if (!res.ok) throw new Error('Failed to fetch share info') - return await res.json() - }, - }) - - if (!shareInfo) return null - - return ( - - ) + return } export const Route = createFileRoute('/share/$shareId/files/$fileId')({ diff --git a/packages/webui/routes/share/$shareId/folders/$folderId.tsx b/packages/webui/routes/share/$shareId/folders/$folderId.tsx index ef31b84b..ed2de98f 100644 --- a/packages/webui/routes/share/$shareId/folders/$folderId.tsx +++ b/packages/webui/routes/share/$shareId/folders/$folderId.tsx @@ -1,34 +1,10 @@ -import { client } from '@/ui/api/client' import { PublicShareManager } from '@/ui/components/public-share-manager' -import { useQuery } from '@tanstack/react-query' import { createFileRoute } from '@tanstack/react-router' function PublicShareFolderPage() { const { shareId, folderId } = Route.useParams() - const { data: shareInfo } = useQuery({ - queryKey: ['share-info', shareId], - queryFn: async () => { - const res = await client.api.shares[':shareId'].info.$get({ - param: { shareId }, - }) - if (!res.ok) throw new Error('Failed to fetch share info') - return await res.json() - }, - }) - - if (!shareInfo) return null - - return ( - - ) + return } export const Route = createFileRoute('/share/$shareId/folders/$folderId')({ diff --git a/packages/webui/routes/share/$shareId/index.tsx b/packages/webui/routes/share/$shareId/index.tsx index f35db185..4fa0017b 100644 --- a/packages/webui/routes/share/$shareId/index.tsx +++ b/packages/webui/routes/share/$shareId/index.tsx @@ -1,34 +1,10 @@ -import { client } from '@/ui/api/client' import { PublicShareManager } from '@/ui/components/public-share-manager' -import { useQuery } from '@tanstack/react-query' import { createFileRoute } from '@tanstack/react-router' function PublicShareIndexPage() { const { shareId } = Route.useParams() - const { data: shareInfo } = useQuery({ - queryKey: ['share-info', shareId], - queryFn: async () => { - const res = await client.api.shares[':shareId'].info.$get({ - param: { shareId }, - }) - if (!res.ok) throw new Error('Failed to fetch share info') - return await res.json() - }, - }) - - if (!shareInfo) return null - - return ( - - ) + return } export const Route = createFileRoute('/share/$shareId/')({ From df6e392bf62fa42192ab5707e97e0d8f086de34b Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 22 Jun 2026 20:32:46 +0800 Subject: [PATCH 2/3] feat(share): expose raw password on settings page --- packages/core/src/share/share.ts | 1 + packages/dtos/src/share.ts | 1 + packages/webui/components/share-settings-sidebar.tsx | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core/src/share/share.ts b/packages/core/src/share/share.ts index 232cba03..a3eb8e1a 100644 --- a/packages/core/src/share/share.ts +++ b/packages/core/src/share/share.ts @@ -301,6 +301,7 @@ export class ShareService { expireAt: l.expireAt?.toISOString(), isDisabled: l.isDisabled, hasPassword: !!l.password, + password: l.password, defaultSortOrder: l.defaultSortOrder, viewMode: l.viewMode, fieldVisibility: l.fieldVisibility as Record | undefined, diff --git a/packages/dtos/src/share.ts b/packages/dtos/src/share.ts index ad2c3317..d19f9436 100644 --- a/packages/dtos/src/share.ts +++ b/packages/dtos/src/share.ts @@ -7,6 +7,7 @@ export interface ShareLinkInfo { expireAt?: string isDisabled: boolean hasPassword: boolean + password?: string | null defaultSortOrder?: string viewMode?: string fieldVisibility?: Record diff --git a/packages/webui/components/share-settings-sidebar.tsx b/packages/webui/components/share-settings-sidebar.tsx index 6dbc71bd..6e6d4ac0 100644 --- a/packages/webui/components/share-settings-sidebar.tsx +++ b/packages/webui/components/share-settings-sidebar.tsx @@ -45,10 +45,14 @@ export function ShareSettingsSidebar({ onSortOrderChange, }: ShareSettingsSidebarProps) { const queryClient = useQueryClient() - const [password, setPassword] = useState('') + const [password, setPassword] = useState(shareLink.password || '') const [expireAt, setExpireAt] = useState( shareLink.expireAt ? new Date(shareLink.expireAt) : undefined, ) + + React.useEffect(() => { + setPassword(shareLink.password || '') + }, [shareLink.password]) const [isPasswordEnabled, setIsPasswordEnabled] = useState(shareLink.hasPassword) const [isExpireEnabled, setIsExpireEnabled] = useState(!!shareLink.expireAt) @@ -146,10 +150,10 @@ export function ShareSettingsSidebar({ {isPasswordEnabled && (
setPassword(e.target.value)} - placeholder={shareLink.hasPassword ? '••••••••' : 'Set password'} + placeholder="Enter password" className="text-xs" />