|
@@ -105,7 +105,22 @@ func (e WebDAVFileSystem) RemoveAll(filename string) error {
|
|
|
func (e WebDAVFileSystem) Rename(oldname, newname string) error {
|
|
|
oldname = filterFilepath(filepath.ToSlash(filepath.Clean(oldname)))
|
|
|
newname = filterFilepath(filepath.ToSlash(filepath.Clean(newname)))
|
|
|
- return e.c.Rename(oldname, newname, true)
|
|
|
+ err := e.c.Rename(oldname, newname, true)
|
|
|
+ if err != nil {
|
|
|
+ //Unable to rename due to reverse proxy issue. Use Copy and Delete
|
|
|
+ f, err := e.c.ReadStream(oldname)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ err = e.c.WriteStream(newname, f, 0775)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ f.Close()
|
|
|
+ e.c.RemoveAll(oldname)
|
|
|
+ }
|
|
|
+ return nil
|
|
|
}
|
|
|
func (e WebDAVFileSystem) Stat(filename string) (os.FileInfo, error) {
|
|
|
filename = filterFilepath(filepath.ToSlash(filepath.Clean(filename)))
|