Implement automatic share link creation and logging for file sharing; make org_id nullable in file_share_links
This commit is contained in:
@@ -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 != "" {
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user