Skip to content

feat: collect public link events - #5174

Open
doubleface wants to merge 4 commits into
masterfrom
fm/publish-public-link-collection-draft
Open

doubleface wants to merge 4 commits into
masterfrom
fm/publish-public-link-collection-draft

Conversation

@doubleface

@doubleface doubleface commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Record public file link creation, updates and successful opens.
  • Record completed downloads of the shared file or whole shared folder, including downloads using temporary links.
  • Preserve download attribution without changing authorization, and report incomplete archive streams.

The VFS, Stack's file storage layer, builds ZIP downloads while
streaming their contents. The final ZIP directory is written only when
the archive writer closes, but its error was previously ignored.
Propagate that failure and reject source files whose copied length
differs from their metadata, so a partial archive cannot be mistaken for
a successful download by the activity collector.
Stack prepares a download URL in one request and serves the bytes in a
later request using a temporary secret. That later request no longer
identifies the public link that authorized the download. Keep its
permission and root identifiers beside the existing secret in memory or
Redis, so completion can be attributed to the right link without
changing access checks, exposing sharecodes or breaking older secrets.
Stack serves public pages and downloads through different handlers, and
its subdomain router wraps the API response in another Echo response.
Collect at successful action boundaries, not URL preparation or asset
requests. Unwrap only Echo's delegating responses to reach a transport
flush that reports errors; do not bypass unknown buffered flushers.
This establishes completed server writes, never client receipt. Keep
events on the link owner's instance and never infer identity from an IP
or sharecode.
Shared-drive recipients forward public download secrets with their own
share-interact token. Its actor identifies the transport, not the
visitor, even when the caller sent no credentials. Exclude that actor
from public-secret download events while preserving verified owner
tokens and sessions, and the actors of authenticated link creation and
modification.
Comment thread model/vfs/archive.go

zw := zip.NewWriter(w)
defer zw.Close()
defer func() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does it affects the http response for the client?

Comment thread model/vfs/archive.go
if entry.Page <= 0 {
_, err = io.Copy(ze, f)
n, err := io.Copy(ze, f)
if err == nil && n != file.ByteSize {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mmm, in this case we will have half of an archive and an error

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants