🐛(backend) fix share invitation email link for files#661
Open
PanchoutNathan wants to merge 2 commits intomainfrom
Open
🐛(backend) fix share invitation email link for files#661PanchoutNathan wants to merge 2 commits intomainfrom
PanchoutNathan wants to merge 2 commits intomainfrom
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Two bugs in the share-invitation email flow (
Item.send_email):File invitations opened an empty folder view. The link was always
built as
/explorer/items/<id>/, which routes to the folder explorerand rendered an empty children list for file items. Fixed by branching
on
item.typeand using/explorer/items/files/<id>/for files —the same route already used by the in-app share-link button.
Invitation links had no scheme. The URL used
Site.objects.get_current().domaindirectly, which Django seeds asexample.comand which carries nohttp://prefix. The resultinghrefwas interpreted as relative by mail clients and 404'd. Fixedby building an absolute URL (
httpinDEBUG,httpsotherwise)from the current
Site, and adding aconfigure_sitemanagementcommand +
SITE_DOMAINenv var so local dev and e2e get a usableSiterow.bootstrapandrun-backend-e2enow call it.Staging/prod must set their
Site.domainonce (via the admin or thenew command) — no helm change shipped here.
Test plan
make bootstrapconfiguresSite.domaintolocalhost:3000http://localhost:3000/explorer/items/files/<id>/and opens the filehttp://localhost:3000/explorer/items/<id>/and opens the folder