mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 15:30:06 +08:00
swift: Make sure we read the size for 0 length files - Fixes #237
This was causing a problem with sync for chunked files. The directory listing would read their size back as 0 and see that the size had changed and immediately resync it.
This commit is contained in:
parent
2aa3c0a2af
commit
8369b5209f
|
@ -210,6 +210,12 @@ func (f *Fs) newFsObjectWithInfo(remote string, info *swift.Object) fs.Object {
|
|||
fs: f,
|
||||
remote: remote,
|
||||
}
|
||||
// Note that due to a quirk of swift, manifest files are
|
||||
// returned as 0 bytes in the listing. Correct this here by
|
||||
// making sure we read the full metadata for all 0 byte files.
|
||||
if info != nil && info.Bytes == 0 {
|
||||
info = nil
|
||||
}
|
||||
if info != nil {
|
||||
// Set info but not headers
|
||||
o.info = *info
|
||||
|
@ -537,9 +543,8 @@ func (o *Object) SetModTime(modTime time.Time) {
|
|||
|
||||
// Storable returns if this object is storable
|
||||
//
|
||||
// It reads the metadata for <= directoryMarkerMaxSize byte objects then compares the
|
||||
// Content-Type to directoryMarkerContentType - that makes it a
|
||||
// directory marker which is not storable.
|
||||
// It compares the Content-Type to directoryMarkerContentType - that
|
||||
// makes it a directory marker which is not storable.
|
||||
func (o *Object) Storable() bool {
|
||||
return o.info.ContentType != directoryMarkerContentType
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user