unexport baseURL and webDavURL

This commit is contained in:
Henrique Dias
2017-06-25 13:09:49 +01:00
parent e6492286db
commit b93158b291
8 changed files with 25 additions and 25 deletions

View File

@@ -20,19 +20,19 @@ type FileManager struct {
*user
Assets *assets
// PrefixURL is a part of the URL that is trimmed from the http.Request.URL before
// it arrives to our handlers. It may be useful when using FileManager as a middleware
// such as in caddy-filemanager plugin. It musn't end with a trailing slash.
PrefixURL string
// BaseURL is the path where the GUI will be accessible. It musn't end with
// a trailing slash and mustn't contain PrefixURL, if set.
BaseURL string
baseURL string
// WebDavURL is the path where the WebDAV will be accessible. It can be set to ""
// in order to override the GUI and only use the WebDAV. It musn't end with
// a trailing slash.
WebDavURL string
webDavURL string
// PrefixURL is a part of the URL that is trimmed from the http.Request.URL before
// it arrives to our handlers. It may be useful when using FileManager as a middleware
// such as in caddy-filemanager plugin. It musn't end with a trailing slash.
PrefixURL string
// Users is a map with the different configurations for each user.
Users map[string]*user
@@ -126,13 +126,13 @@ func New(scope string) *FileManager {
// AbsoluteURL returns the actual URL where
// File Manager interface can be accessed.
func (m FileManager) AbsoluteURL() string {
return m.PrefixURL + m.BaseURL
return m.PrefixURL + m.baseURL
}
// AbsoluteWebDavURL returns the actual URL
// where WebDAV can be accessed.
func (m FileManager) AbsoluteWebDavURL() string {
return m.PrefixURL + m.WebDavURL
return m.PrefixURL + m.webDavURL
}
// SetBaseURL updates the BaseURL of a File Manager
@@ -141,7 +141,7 @@ func (m *FileManager) SetBaseURL(url string) {
url = strings.TrimPrefix(url, "/")
url = strings.TrimSuffix(url, "/")
url = "/" + url
m.BaseURL = strings.TrimSuffix(url, "/")
m.baseURL = strings.TrimSuffix(url, "/")
}
// SetWebDavURL updates the WebDavURL of a File Manager
@@ -150,11 +150,11 @@ func (m *FileManager) SetWebDavURL(url string) {
url = strings.TrimPrefix(url, "/")
url = strings.TrimSuffix(url, "/")
m.WebDavURL = m.BaseURL + "/" + url
m.webDavURL = m.baseURL + "/" + url
// update base user webdav handler
m.handler = &webdav.Handler{
Prefix: m.WebDavURL,
Prefix: m.webDavURL,
FileSystem: m.fileSystem,
LockSystem: webdav.NewMemLS(),
}
@@ -163,7 +163,7 @@ func (m *FileManager) SetWebDavURL(url string) {
// the new URL
for _, u := range m.Users {
u.handler = &webdav.Handler{
Prefix: m.WebDavURL,
Prefix: m.webDavURL,
FileSystem: u.fileSystem,
LockSystem: webdav.NewMemLS(),
}
@@ -189,7 +189,7 @@ func (m *FileManager) SetScope(scope string, username string) error {
u.fileSystem = webdav.Dir(u.scope)
u.handler = &webdav.Handler{
Prefix: m.WebDavURL,
Prefix: m.webDavURL,
FileSystem: u.fileSystem,
LockSystem: webdav.NewMemLS(),
}