mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
avoid overwriting file or directory
fix https://github.com/chrislusf/seaweedfs/issues/777
This commit is contained in:
parent
021f5d689b
commit
ceca078acb
|
@ -132,6 +132,12 @@ func (f *Filer) CreateEntry(entry *Entry) error {
|
||||||
return fmt.Errorf("insert entry %s: %v", entry.FullPath, err)
|
return fmt.Errorf("insert entry %s: %v", entry.FullPath, err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if oldEntry.IsDirectory() && !entry.IsDirectory() {
|
||||||
|
return fmt.Errorf("existing %s is a directory", entry.FullPath)
|
||||||
|
}
|
||||||
|
if !oldEntry.IsDirectory() && entry.IsDirectory() {
|
||||||
|
return fmt.Errorf("existing %s is a file", entry.FullPath)
|
||||||
|
}
|
||||||
if err := f.store.UpdateEntry(entry); err != nil {
|
if err := f.store.UpdateEntry(entry); err != nil {
|
||||||
return fmt.Errorf("update entry %s: %v", entry.FullPath, err)
|
return fmt.Errorf("update entry %s: %v", entry.FullPath, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue