Skip to content

fix: download the displayed public folder - #4506

Open
doubleface wants to merge 2 commits into
masterfrom
fm/fix-public-folder-download-event
Open

doubleface wants to merge 2 commits into
masterfrom
fm/fix-public-folder-download-event

Conversation

@doubleface

@doubleface doubleface commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Download the displayed public folder instead of its loaded children, including files not yet displayed. The ZIP contains the folder itself.
  • Add an E2E test that downloads the folder and verifies the ZIP contents.

Why

To detect a download event on public link folder, we need the main folder of a public link to be downloaded and not its children.

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: linagora/twake-drive
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 87f5762
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a0d3734-cccc-483a-a558-c96534bbf545
Commits

Reviewing files that changed from the base of the PR and between 2bf4c86 and 9c52e0f.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The public-link toolbar now offers a folder download when the displayed folder has an ID and requests a selection-wide archive download. Tests cover root and subfolder downloads, mobile behavior, explicit selections, and missing folder IDs. An end-to-end test downloads a shared folder as a ZIP and checks root and nested file paths and contents. E2E prerequisites now list host unzip.

Possibly related issues

  • Issue 4452: The change exercises a whole-folder public-link download, which is the activity named in the issue objective. The summaries do not describe access-history recording.

Change: Bug fix

Merge Risk: Minimal · previous review 2bf4c

The change downloads the displayed folder itself, with archive contents covered by tests. No concrete merge-blocking issue remains; merge after normal checks pass.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: downloading the displayed public folder.
Description check Passed The description directly explains the folder download behavior and the added E2E coverage.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: linagora/twake-drive
  • Branch: master
  • File: .coderabbit.yaml
  • Commit: 87f5762
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 33155a2f-d3d7-4a1a-92bb-60b07b77fc05
Commits

Reviewing files that changed from the base of the PR and between 87f5762 and 2bf4c86.

Files selected for processing: 5
  • docs/e2e.md
  • e2e/pages/PublicLinkPage.ts
  • e2e/tests/z-link-sharing.spec.ts
  • src/modules/public/PublicToolbarByLink.jsx
  • src/modules/public/PublicToolbarByLink.spec.jsx

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
rsdoctor-data.json 32.7 MB 9.2 MB +73.0 B (0.0%) +27.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 rsdoctor-data.json

Path: rsdoctor-data.json

📌 Baseline Commit: 87f576200872a9091a3ff1dfb4edf3668c925030 | PR: #4504

Metric Current Baseline Change
📊 Total Size 32.7 MB 32.7 MB +73.0 B (0.0%)
🗜️ Gzip Size 9.2 MB 9.2 MB +27.0 B (0.0%)
📄 JavaScript 17.0 MB 17.0 MB +73.0 B (0.0%)
🎨 CSS 375.9 KB 375.9 KB 0
🌐 HTML 11.8 KB 11.8 KB 0
📁 Other Assets 15.4 MB 15.4 MB 0

📦 Download Diff Report: rsdoctor-data.json Bundle Diff

Generated by Rsdoctor GitHub Action

@bundlemon

bundlemon Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

BundleMon

Files updated (1)
Status Path Size Limits
✅ static/js/public.(hash).js
30.58KB (+27B +0.09%) -
Unchanged files (14)
Status Path Size Limits
✅ static/js/main.(hash).js
67.56KB -
✅ static/js/lib-react.(hash).js
43.81KB -
✅ static/js/lib-router.(hash).js
26.49KB -
✅ static/js/lib-polyfill.(hash).js
22.58KB -
✅ static/js/intents.(hash).js
21.84KB -
✅ static/css/main.(hash).css
8.47KB -
✅ manifest.webapp
7.02KB -
✅ static/css/public.(hash).css
2.82KB -
✅ services/qualificationMigration.js
2.33KB -
✅ services/dacc.js
2.05KB -
✅ index.html
1.15KB -
✅ public/index.html
1.07KB -
✅ intents/index.html
1004B -
✅ assets/manifest.json
185B -

Total files change +23B +0.01%

Groups updated (1)
Status Path Size Limits
✅ **/*.js
5.35MB (+27B 0%) -
Unchanged groups (2)
Status Path Size Limits
✅ **/*.{png,svg,ico}
2.19MB -
✅ **/*.css
70.18KB -

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@doubleface doubleface added the e2e Run the E2E suite on this PR label Nov 4, 2026
@doubleface
doubleface marked this pull request as ready for review November 4, 2026 16:08
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

OpenCode review

No findings reaching Minor. The download wiring is correct: download({ isSelectAll: true, displayedFolder }) makes download.jsx:59-61 archive [displayedFolder.id], which FileCollection.downloadArchive sends as POST /files/archive with ids: [folderId], so the stack zips the folder itself (verified in cozy-client@61.0.1 FileCollection.js and the stack model/vfs/archive.go naming a.Name + "/" + relpath). The displayedFolder?.id && guard is safely filtered by makeActions (helpers.js), and explicit selection downloads still go through the separate PublicFolderView action array, so they are unaffected.

Details

I opened the changed files plus their callers (PublicToolbar, PublicFolderView, LightFileViewer), download.jsx/utils.js, useDisplayedFolder, useCurrentFolderId, the cozy-ui makeActions helper, cozy-client@61.0.1 FileCollection, and the stack archive source, and could not construct a failure scenario.

Things I could not check in this run: I did not execute Jest or Playwright (no node_modules in the workspace), so the new spec and E2E test are only reviewed statically. The E2E test's ZIP structure assumption matches the stack source I read, but the suite itself was not run.

github run

@doubleface
doubleface force-pushed the fm/fix-public-folder-download-event branch from 2bf4c86 to 9c52e0f Compare November 4, 2026 16:22

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

OpenCode review

No findings reaching Minor.

Details

I opened the changed files and their callers (PublicToolbar, PublicFolderView, LightFileViewer, PublicToolbarMoreMenu, DrivePage/PublicLinkPage), the download action and downloadFiles (src/modules/actions/download.jsx:57-63, utils.js:36-48), useDisplayedFolder/useCurrentFolderId, the public routes (AppRouter.jsx), and the cozy-ui makeActions helper at the pinned version cozy-ui@143.0.0 (react/ActionsMenu/Actions/helpers.js: actions.filter(Boolean).map(actionFn => actionFn(options))). The displayedFolder?.id && (options => download({ ...options, isSelectAll: true, displayedFolder })) entry is therefore filtered out when the id is missing, and download with isSelectAll builds [displayedFolder], which downloadFiles turns into downloadArchive([displayedFolder.id]). This mirrors the existing desktop behaviour in src/modules/drive/Toolbar/components/MoreMenu.jsx:96 (files={[displayedFolder]}), so the pattern is already established.

I also read cozy-client@61.0.1/cozy-stack-client@61.0.0 FileCollection (downloadArchive → createArchiveLinkByIds posting to /files/archive with attributes.ids) and the stack model/vfs/archive.go on master (zw.Create(a.Name + "/" + name + "/")), which confirms the E2E expectation files/<folder>/... and that a folder id produces an archive rooted at the folder name. Explicit selection downloads are unaffected: they go through the separate PublicFolderView actions array (PublicFolderView.jsx:143-160) where isSelectAll is not set. LightFileViewer passes a single file, so the toolbar more-menu never renders there (files.length > 1).

I could not run Jest or Playwright in this run (no node_modules), so the new spec and E2E test are reviewed statically only; the ZIP-structure assumption matches the stack source I read but the suite was not executed.

Non-blocking, pre-existing (not introduced here): isMoreMenuDisplayed = files.length > 1 (PublicToolbarByLink.jsx:33) means a public folder with 0 or 1 item shows no more menu, so the new folder-download action — and the stack download event it is meant to trigger — is unreachable for a single-item public folder. The diff does not touch that gate.

github run

This branch has not been deployed

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

Labels

e2e Run the E2E suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant