Skip to content

fix(sharing): use folder link for Copy link on folders (#2987)#2988

Open
cqnykamp wants to merge 3 commits into
Doenet:mainfrom
cqnykamp:fix-2987-share-unlisted-folder
Open

fix(sharing): use folder link for Copy link on folders (#2987)#2988
cqnykamp wants to merge 3 commits into
Doenet:mainfrom
cqnykamp:fix-2987-share-unlisted-folder

Conversation

@cqnykamp

@cqnykamp cqnykamp commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #2987

Problem

Copying the share link for an unlisted folder produced a 404. The link was of the form .../activityViewer/<id>, which is a route that only serves activities — not folders.

Root cause

ShareModal hard-coded the shareable link to /activityViewer/${contentId} for all content types. Folders must be opened via /sharedActivities/${ownerId}/${folderId} (the same format used everywhere else folder links are generated, e.g. SharedActivities.tsx).

The issue also reported that manually rewriting the URL to .../sharedActivities/<id> still 404s. That is not a real API bug:

  • isOpenableSharedFolder already permits unlisted folders, and
  • updateVisibility cascades a folder's visibility down to all descendants, so the contents are visible too.

The manual URL 404'd only because it placed the folder id in the ownerId slot (with no parent segment), so getUser on a non-user id threw. The correct two-segment link works.

Changes

  • getEditorShareStatus now returns ownerId (short URL form via fromUUID), needed to build a folder link.
  • Added ownerId to the SharingData type and plumbed it into SharePublicly.
  • shareableLink now builds /sharedActivities/${ownerId}/${contentId} for folders and keeps /activityViewer/${contentId} for other content.
  • Updated the API test fixture and added two ShareModal.cy.tsx cases asserting the clipboard receives the correct folder vs. activity URL.

🤖 Generated with Claude Code

cqnykamp and others added 3 commits July 3, 2026 23:34
The share modal hard-coded the shareable link to /activityViewer/<id>
for all content types, but that route only serves activities, so
copying the link for a folder produced a 404.

Build /sharedActivities/<ownerId>/<id> for folders (matching how folder
links are generated elsewhere) and keep /activityViewer/<id> for other
content. getEditorShareStatus now returns the owner id needed to build
the folder link.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The folder-vs-activity view-link ternary was duplicated across
SharedActivities, SharedWithMe, Explore, and (newly) ShareModal.
Extract a single contentViewerUrl helper in utils/url.ts and route all
four sites through it. Behavior is preserved, including Explore's
fallback to the activity viewer for a folder with no known owner.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cqnykamp cqnykamp requested a review from dqnykamp July 4, 2026 14:02
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.

[Bug]: 404 error when trying to share unlisted folder

1 participant