mirror of
https://github.com/photoprism/photoprism.git
synced 2026-07-17 16:49:04 +00:00
Server: Derive WebDAV proxy test paths from proxy.PathPrefix
TestIsWebDAVPath hardcoded the "/i/" proxy prefix, so it failed when proxy.DefaultPathPrefix changed. Build the proxy cases from proxy.PathPrefix, the same value IsWebDAVPath uses, so they track the configured prefix.
This commit is contained in:
parent
a693df1eaa
commit
c9f21cd965
1 changed files with 10 additions and 4 deletions
|
|
@ -1,8 +1,14 @@
|
|||
package server
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/photoprism/photoprism/pkg/http/proxy"
|
||||
)
|
||||
|
||||
func TestIsWebDAVPath(t *testing.T) {
|
||||
// Derive proxy paths from the configured prefix so the cases stay valid
|
||||
// regardless of the proxy.PathPrefix / proxy.DefaultPathPrefix value.
|
||||
tests := []struct {
|
||||
name string
|
||||
path string
|
||||
|
|
@ -11,12 +17,12 @@ func TestIsWebDAVPath(t *testing.T) {
|
|||
}{
|
||||
{name: "RootOriginals", path: "/originals", want: true},
|
||||
{name: "RootImportChild", path: "/import/folder/file.jpg", want: true},
|
||||
{name: "ProxyOriginals", path: "/i/acme/originals/", want: true},
|
||||
{name: "ProxyImport", path: "/i/acme/import/a.jpg", want: true},
|
||||
{name: "ProxyOriginals", path: proxy.PathPrefix + "acme/originals/", want: true},
|
||||
{name: "ProxyImport", path: proxy.PathPrefix + "acme/import/a.jpg", want: true},
|
||||
{name: "CustomBaseOriginals", path: "/instance-a/originals/album", basePaths: []string{"/instance-a/originals", "/instance-a/import"}, want: true},
|
||||
{name: "CustomBaseImport", path: "/instance-a/import", basePaths: []string{"/instance-a/originals", "/instance-a/import"}, want: true},
|
||||
{name: "LibraryPath", path: "/library/browse", want: false},
|
||||
{name: "ProxyNonDAV", path: "/i/acme/library", want: false},
|
||||
{name: "ProxyNonDAV", path: proxy.PathPrefix + "acme/library", want: false},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue