mirror of
https://github.com/openziti/zrok.git
synced 2025-02-22 05:01:01 +01:00
remove 'checksum' support until next phase (#438)
This commit is contained in:
parent
094d22872a
commit
a975b69541
@ -6,10 +6,7 @@ package webdav
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha512"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"github.com/sirupsen/logrus"
|
||||
"io"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
@ -67,21 +64,12 @@ type webdavFile struct {
|
||||
|
||||
func (f *webdavFile) DeadProps() (map[xml.Name]Property, error) {
|
||||
var (
|
||||
xmlName xml.Name
|
||||
property Property
|
||||
properties = make(map[xml.Name]Property)
|
||||
checksum, err = f.checksum()
|
||||
xmlName xml.Name
|
||||
property Property
|
||||
properties = make(map[xml.Name]Property)
|
||||
)
|
||||
if err == nil {
|
||||
xmlName.Space = "zrok:"
|
||||
xmlName.Local = "checksum"
|
||||
property.XMLName = xmlName
|
||||
property.InnerXML = []byte(checksum)
|
||||
properties[xmlName] = property
|
||||
}
|
||||
|
||||
var stat fs.FileInfo
|
||||
stat, err = f.Stat()
|
||||
stat, err := f.Stat()
|
||||
if err == nil {
|
||||
xmlName.Space = "zrok:"
|
||||
xmlName.Local = "lastmodified"
|
||||
@ -112,21 +100,6 @@ func (f *webdavFile) Patch(patches []Proppatch) ([]Propstat, error) {
|
||||
return []Propstat{stat}, nil
|
||||
}
|
||||
|
||||
func (f *webdavFile) checksum() (string, error) {
|
||||
file, err := os.Open(f.name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer file.Close()
|
||||
hash := sha512.New()
|
||||
if _, err := io.Copy(hash, file); err != nil {
|
||||
return "", err
|
||||
}
|
||||
sha512 := fmt.Sprintf("%x", hash.Sum(nil))
|
||||
logrus.Infof("%v = %v", f.name, sha512)
|
||||
return sha512, nil
|
||||
}
|
||||
|
||||
func (f *webdavFile) updateModtime(path string, modtime time.Time) error {
|
||||
if err := os.Chtimes(f.name, time.Now(), modtime); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user