feat(oo): file deep links, login check, replace-in (fresh upload)

- link: print Products/Files/DocEditor.aspx?fileid=… deep links (title+url)
- lib: FileEditorURL/FolderURL helpers (+tests)
- users check: verify credentials (userName vs email) via authentication.json
- projects files replace-in FOLDER_ID FILE...: hard delete same stem|ext in a
  folder + fresh upload → single clean version (no version history)
This commit is contained in:
2026-09-22 22:41:14 +01:00
parent ee8e88fb9b
commit df38b75011
7 changed files with 230 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
package onlyoffice
// Deep links to OnlyOffice portal objects.
import (
"fmt"
"net/url"
"strings"
)
// FileEditorURL builds the OnlyOffice DocEditor deep link for a portal file id:
//
// https://<portal>/Products/Files/DocEditor.aspx?fileid=<id>
//
// portalBase may include a trailing slash; fileID is trimmed and URL-escaped.
func FileEditorURL(portalBase, fileID string) string {
base := strings.TrimRight(strings.TrimSpace(portalBase), "/")
return fmt.Sprintf("%s/Products/Files/DocEditor.aspx?fileid=%s",
base, url.QueryEscape(strings.TrimSpace(fileID)))
}
// FileEditorURL is the client-bound convenience wrapper (uses the portal URL
// the client was built with).
func (c *Client) FileEditorURL(fileID string) string {
return FileEditorURL(c.baseURL(), fileID)
}
// FolderURL builds a Documents-folder deep link for a folder id.
func FolderURL(portalBase, folderID string) string {
base := strings.TrimRight(strings.TrimSpace(portalBase), "/")
return fmt.Sprintf("%s/Products/Files/Default.aspx#folder=%s", base, url.QueryEscape(strings.TrimSpace(folderID)))
}
// FolderURL is the client-bound convenience wrapper.
func (c *Client) FolderURL(folderID string) string {
return FolderURL(c.baseURL(), folderID)
}