mirror of https://github.com/perkeep/perkeep.git
camput: reorder file type switch; fixes symlink bug
Change-Id: Ic4d0f6c2be02d153f933d72c1a02e72926c36786
This commit is contained in:
parent
0fa34e75b0
commit
9447a8cb78
2
TODO
2
TODO
|
@ -1,5 +1,3 @@
|
|||
-- camput file <dir> doesn't work when <dir> contains a symlink?
|
||||
|
||||
-- Go 1: convert all the fuse code & camlistore.org/pkg/fs to use rsc/fuse
|
||||
(get cammount and webdav working again)
|
||||
|
||||
|
|
|
@ -200,6 +200,19 @@ func (up *Uploader) UploadFile(filename string, rollSplits bool) (respr *client.
|
|||
m := schema.NewCommonFileMap(filename, fi)
|
||||
mode := fi.Mode()
|
||||
switch {
|
||||
case mode&os.ModeSymlink != 0:
|
||||
if err = schema.PopulateSymlinkMap(m, filename); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case mode&os.ModeDevice != 0:
|
||||
// including mode & os.ModeCharDevice
|
||||
fallthrough
|
||||
case mode&os.ModeSocket != 0:
|
||||
fallthrough
|
||||
case mode&os.ModeNamedPipe != 0: // FIFO
|
||||
fallthrough
|
||||
default:
|
||||
return nil, schema.ErrUnimplemented
|
||||
case !fi.IsDir():
|
||||
m["camliType"] = "file"
|
||||
|
||||
|
@ -234,10 +247,6 @@ func (up *Uploader) UploadFile(filename string, rollSplits bool) (respr *client.
|
|||
pr := &client.PutResult{BlobRef: blobref, Size: int64(len(json)), Skipped: false}
|
||||
return pr, nil
|
||||
}
|
||||
case mode&os.ModeSymlink != 0:
|
||||
if err = schema.PopulateSymlinkMap(m, filename); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case fi.IsDir():
|
||||
ss := new(schema.StaticSet)
|
||||
dir, err := os.Open(filename)
|
||||
|
@ -310,15 +319,6 @@ func (up *Uploader) UploadFile(filename string, rollSplits bool) (respr *client.
|
|||
return nil, err
|
||||
}
|
||||
schema.PopulateDirectoryMap(m, sspr.BlobRef)
|
||||
case mode&os.ModeDevice != 0:
|
||||
// including mode & os.ModeCharDevice
|
||||
fallthrough
|
||||
case mode&os.ModeSocket != 0:
|
||||
fallthrough
|
||||
case mode&os.ModeNamedPipe != 0: // FIFO
|
||||
fallthrough
|
||||
default:
|
||||
return nil, schema.ErrUnimplemented
|
||||
}
|
||||
|
||||
mappr, err := up.UploadMap(m)
|
||||
|
|
Loading…
Reference in New Issue