Skip to content

feat(lib): specialised error message when preview blocked by watermark - #1986

Open
aleksanderelsner wants to merge 1 commit into
box:masterfrom
aleksanderelsner:CONTSEC-2989
Open

aleksanderelsner wants to merge 1 commit into
box:masterfrom
aleksanderelsner:CONTSEC-2989

Conversation

@aleksanderelsner

@aleksanderelsner aleksanderelsner commented Nov 26, 2026 •

Copy link
Copy Markdown

Folder and access policy watermarking is type-agnostic.
When a file that does not support watermarking is placed in a watermarked folder, or has access policy that enforces watermarking, preview fails. That's because we remove preview permissions when we are unable to watermark the file.

Current behavior

Roles below editor, shared-link recipients, including a users in another enterprise: "This preview didn't load because you don't have permission. Please ask the file owner to update permissions."
Folder settings already tell the owner that some file types are hidden from Viewers, Previewers, and Previewer Uploaders. The preview error does not match that sentence.

Summary by CodeRabbit

  • Bug Fixes
    • Preview failures now show a more specific message when watermarking prevents an unsupported file type from being viewed, distinguishing inherited watermark settings from access-policy requirements.
    • Watermarked videos without a playable format now display the relevant watermark-related error instead of a generic account error. When preview access is denied because watermarking blocks an unsupported file, the error message also identifies whether the watermark comes from a parent folder or an access policy.

@aleksanderelsner
aleksanderelsner requested a review from a team as a code owner November 26, 2026 13:54
@CLAassistant

CLAassistant commented Nov 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Preview reports a watermark-specific unsupported-file-type error when watermarking blocks a preview. The error distinguishes inherited watermarking from access-policy watermarking. Other preview permission and account error paths remain unchanged.

Changes

Watermark preview errors

Layer / File(s) Summary
Watermark-specific preview error handling
src/lib/Preview.js, src/i18n/en-US.properties, src/lib/__tests__/Preview-test.js
Preview selects a localized error for inherited or access-policy watermarking. It uses the error when a watermarked video has no playable representation or when preview permission is absent and the file is marked as blocked by watermark. Tests cover both failure paths.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: jackiejou, jchan106, zhirongwang

Merge Risk: Minimal · up to 2364f

Previews blocked by watermarking now show a specific error message instead of a generic one. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: a specialised error message shown when a preview is blocked by a watermark. The raw summary confirms this: Preview.js adds a throwPreviewBlockedByWatermarkError helper…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: a specialised error message shown when a preview is blocked by a watermark. The raw summary confirms this: Preview.js adds a throwPreviewBlockedByWatermarkError helper that selects the inherited-watermark or access-policy message, and en-US.properties gains the matching entries. The title is specific, concise, and follows the conventional commit style. It uses the scope 'lib', which matches src/lib/Preview.js.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.3)

src/lib/__tests__/Preview-test.js

ast-grep timed out on this file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the preview’s way,
Two watermark errors now hold sway.
For inherited marks, one message appears,
Policy marks bring a message that clears.
Unsupported files are named with care,
The rabbit hops, content to share.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8537a10a-f36d-41cb-9674-dc6b044ad8f0
Commits

Reviewing files that changed from the base of the PR and between 215f43c and 2364f99.

Files selected for processing: 1

  • src/lib/__tests__/Preview-test.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

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.

2 participants