Skip to content

feat:(PB-6297) show image thumbnails in public shared folder preview - #2053

Open
victor-ferro wants to merge 6 commits into
PB-6297-folder-link-previewfrom
PB-6297-thumbnails
Open

feat:(PB-6297) show image thumbnails in public shared folder preview#2053
victor-ferro wants to merge 6 commits into
PB-6297-folder-link-previewfrom
PB-6297-thumbnails

Conversation

@victor-ferro

Copy link
Copy Markdown

Description

Second part of PB-6297, stacked on #2052. The public shared folder listing now shows real image thumbnails instead of the generic file-type icon.

Thumbnails are encrypted files in the network like any other, so downloading one needs the same three inputs as a regular file: its network coordinates, the share network credentials, and the decryption key. This PR wires those for the public (unauthenticated) context:

  • derivePublicSharingKey (new, extracted in share.service.ts): the aes.decrypt(encryptionKey, code) + sharing-version handling that lived inline in downloadPublicSharedFolder is now a reusable function returning a FileKey ({ bucketKey } for inxt-v3 sharings, { mnemonic } for older ones). downloadPublicSharedFolder now consumes it — pure refactor, no behavior change.
  • downloadPublicThumbnail (new in thumbnail.service.ts): downloads and decrypts a thumbnail (bucket_id/bucket_file) with explicit credentials and key, returning a Blob — the existing downloadThumbnail relies on the authenticated user context, which does not exist on a public link.
  • PublicSharedItemList: for image items with a thumbnail, downloads it and renders it via URL.createObjectURL (revoked on unmount); falls back to the type icon otherwise. Credentials travel per-item (set by the hook from the files response), and the share key is derived once in PublicSharedFolderContent (useMemo) and passed down.
  • ShareFolderView: passes encryptionKey/sharingVersion from the sharing meta down to the preview.

Related Issues

Relates to PB-6297.

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

  • Unit tests: yarn vitest run src/app/drive/services/thumbnail.service.test.ts — new case: "When downloading a public thumbnail, then it downloads the thumbnail file with the share credentials and key".
  • yarn typecheck and yarn lint clean; full unit suite run by the pre-commit hook.
  • Manual: opened a public shared folder link containing images, verified thumbnails render in the listing after the files page loads, non-image items keep their type icon, and navigation between folders loads each level's thumbnails. Checked both sharing versions derive a working key (v2 mnemonic / v3 bucketKey).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: f2afcd8
Status: ✅  Deploy successful!
Preview URL: https://898ed71c.drive-web.pages.dev
Branch Preview URL: https://pb-6297-thumbnails.drive-web.pages.dev

View logs

@victor-ferro victor-ferro self-assigned this Jul 24, 2026

useEffect(() => {
const thumbnail = (item.thumbnails as Thumbnail[] | undefined)?.[0];
const isImage = !item.isFolder && !!item.type && thumbnailableImageExtension.includes(item.type.toLowerCase());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not only the images has thumbnails, also the videos and some docs as pdfs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Totally!!! Done!

Comment on lines +48 to +51
downloadPublicThumbnail(
thumbnail,
{ user: item.credentials.networkUser, pass: item.credentials.networkPass },
publicShareKey,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: For quick navigation and folders containing lots of images, an abort controller might come in handy (this would also apply to Drive, which doesn’t have one, and it would be good to be able to cancel requests. I’m not saying we should do the Drive part here! haha)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done!

@victor-ferro
victor-ferro requested a review from CandelR July 27, 2026 17:16
# Conflicts:
#	src/views/PublicShared/components/PublicSharedFolderContent.tsx
@victor-ferro
victor-ferro requested a review from xabg2 as a code owner July 28, 2026 16:27
@sonarqubecloud

Copy link
Copy Markdown

@xabg2 xabg2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Only checked the payments-related changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants