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:
@@ -0,0 +1,24 @@
|
||||
package onlyoffice
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestFileEditorURL(t *testing.T) {
|
||||
cases := []struct{ base, id, want string }{
|
||||
{"https://office.example.com", "3651", "https://office.example.com/Products/Files/DocEditor.aspx?fileid=3651"},
|
||||
{"https://office.example.com/", " 3687 ", "https://office.example.com/Products/Files/DocEditor.aspx?fileid=3687"},
|
||||
{"http://localhost:8087", "a/b", "http://localhost:8087/Products/Files/DocEditor.aspx?fileid=a%2Fb"},
|
||||
}
|
||||
for _, c := range cases {
|
||||
if got := FileEditorURL(c.base, c.id); got != c.want {
|
||||
t.Fatalf("FileEditorURL(%q,%q) = %q, want %q", c.base, c.id, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFolderURL(t *testing.T) {
|
||||
got := FolderURL("https://office.example.com/", "495")
|
||||
want := "https://office.example.com/Products/Files/Default.aspx#folder=495"
|
||||
if got != want {
|
||||
t.Fatalf("FolderURL = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user