Skip to content

🐛(backend) fix share invitation email link for files#661

Open
PanchoutNathan wants to merge 2 commits intomainfrom
fix/639
Open

🐛(backend) fix share invitation email link for files#661
PanchoutNathan wants to merge 2 commits intomainfrom
fix/639

Conversation

@PanchoutNathan
Copy link
Copy Markdown
Contributor

@PanchoutNathan PanchoutNathan commented Apr 13, 2026

Summary

Two bugs in the share-invitation email flow (Item.send_email):

  1. File invitations opened an empty folder view. The link was always
    built as /explorer/items/<id>/, which routes to the folder explorer
    and rendered an empty children list for file items. Fixed by branching
    on item.type and using /explorer/items/files/<id>/ for files —
    the same route already used by the in-app share-link button.

  2. Invitation links had no scheme. The URL used
    Site.objects.get_current().domain directly, which Django seeds as
    example.com and which carries no http:// prefix. The resulting
    href was interpreted as relative by mail clients and 404'd. Fixed
    by building an absolute URL (http in DEBUG, https otherwise)
    from the current Site, and adding a configure_site management
    command + SITE_DOMAIN env var so local dev and e2e get a usable
    Site row. bootstrap and run-backend-e2e now call it.

Staging/prod must set their Site.domain once (via the admin or the
new command) — no helm change shipped here.

Test plan

  • make bootstrap configures Site.domain to localhost:3000
  • Invite a user to a file; email link points to
    http://localhost:3000/explorer/items/files/<id>/ and opens the file
  • Invite a user to a folder; link points to
    http://localhost:3000/explorer/items/<id>/ and opens the folder

@PanchoutNathan PanchoutNathan linked an issue Apr 13, 2026 that may be closed by this pull request
Clicking the invitation link for a shared file opened the folder
explorer page with an empty children listing, because
`Item.send_email` hardcoded `/explorer/items/<uuid>/` regardless of
the item type.

Branch on `item.type` to use the dedicated file route
`/explorer/items/files/<uuid>/` already served by nginx and used by
the in-app share-link copy button.
Share invitation emails embedded `Site.domain` directly, producing
schemeless links that browsers and mail clients failed to resolve.
Build an absolute URL from the current Site (http in DEBUG, https
otherwise) and ship a `configure_site` management command plus a
`SITE_DOMAIN` env var so local dev and e2e get a usable Site row.
@sonarqubecloud
Copy link
Copy Markdown

@PanchoutNathan PanchoutNathan requested a review from lunika April 14, 2026 09:52
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.

File opening as a folder

1 participant