mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
fix file info URL and webdav move destination URL
Former-commit-id: ee1536160e
This commit is contained in:
parent
0ad540249e
commit
70aa887061
@ -137,10 +137,13 @@ webdav.convertURL = function (url) {
|
|||||||
|
|
||||||
webdav.move = function (oldLink, newLink) {
|
webdav.move = function (oldLink, newLink) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let request = new XMLHttpRequest();
|
let request = new XMLHttpRequest(),
|
||||||
|
destination = newLink.replace(baseURL + "/", webdavURL + "/");
|
||||||
|
|
||||||
|
destination = window.location.origin + destination.substring(prefixURL.length);
|
||||||
|
|
||||||
request.open('MOVE', webdav.convertURL(oldLink), true);
|
request.open('MOVE', webdav.convertURL(oldLink), true);
|
||||||
request.setRequestHeader('Destination', webdav.convertURL(newLink));
|
request.setRequestHeader('Destination', destination);
|
||||||
request.onload = () => {
|
request.onload = () => {
|
||||||
if(request.status == 201 || request.status == 204) {
|
if(request.status == 201 || request.status == 204) {
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -562,4 +562,4 @@ document.addEventListener('DOMContentLoaded', event => {
|
|||||||
document.addEventListener("drop", listing.documentDrop, false);
|
document.addEventListener("drop", listing.documentDrop, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
<script>
|
<script>
|
||||||
var user = JSON.parse('{{ Marshal .User }}'),
|
var user = JSON.parse('{{ Marshal .User }}'),
|
||||||
webdavURL = "{{.Config.AbsoluteURL}}{{.Config.WebDavURL}}",
|
webdavURL = "{{.Config.AbsoluteURL}}{{.Config.WebDavURL}}",
|
||||||
baseURL = "{{.Config.AbsoluteURL}}";
|
baseURL = "{{.Config.AbsoluteURL}}",
|
||||||
|
prefixURL = "{{ .Config.PrefixURL }}";
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/common.js" defer></script>
|
<script src="{{ .Config.AbsoluteURL }}/_filemanagerinternal/js/common.js" defer></script>
|
||||||
{{- if .IsDir }}
|
{{- if .IsDir }}
|
||||||
|
@ -36,7 +36,7 @@ type Info struct {
|
|||||||
func GetInfo(url *url.URL, c *config.Config, u *config.User) (*Info, int, error) {
|
func GetInfo(url *url.URL, c *config.Config, u *config.User) (*Info, int, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
i := &Info{URL: url.Path}
|
i := &Info{URL: c.PrefixURL + url.Path}
|
||||||
i.VirtualPath = strings.Replace(url.Path, c.BaseURL, "", 1)
|
i.VirtualPath = strings.Replace(url.Path, c.BaseURL, "", 1)
|
||||||
i.VirtualPath = strings.TrimPrefix(i.VirtualPath, "/")
|
i.VirtualPath = strings.TrimPrefix(i.VirtualPath, "/")
|
||||||
i.VirtualPath = "/" + i.VirtualPath
|
i.VirtualPath = "/" + i.VirtualPath
|
||||||
|
Loading…
Reference in New Issue
Block a user