Implement automatic share link creation and logging for file sharing; make org_id nullable in file_share_links

This commit is contained in:
Leon Bösche
2026-01-24 23:45:08 +01:00
parent 82eba17a82
commit ea5c297641
4 changed files with 32 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/url"
@@ -2822,6 +2823,8 @@ func createFileShareLinkHandler(w http.ResponseWriter, r *http.Request, db *data
return
}
log.Printf("Share link created: user_id=%s, file_id=%s, org_id=%v", userID, fileUUID, link.OrgID)
// Build full URL
scheme := "https"
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {
@@ -3154,6 +3157,8 @@ func createUserFileShareLinkHandler(w http.ResponseWriter, r *http.Request, db *
return
}
log.Printf("Share link created: user_id=%s, file_id=%s, org_id=%v", userID, fileUUID, link.OrgID)
// Build full URL
scheme := "https"
if proto := r.Header.Get("X-Forwarded-Proto"); proto != "" {

View File

@@ -0,0 +1,3 @@
-- Make org_id nullable in file_share_links for personal file sharing
ALTER TABLE file_share_links ALTER COLUMN org_id DROP NOT NULL;

View File

@@ -0,0 +1,3 @@
-- Revert: Make org_id not nullable in file_share_links
ALTER TABLE file_share_links ALTER COLUMN org_id SET NOT NULL;