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
|
-- Go 1: convert all the fuse code & camlistore.org/pkg/fs to use rsc/fuse
|
||||||
(get cammount and webdav working again)
|
(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)
|
m := schema.NewCommonFileMap(filename, fi)
|
||||||
mode := fi.Mode()
|
mode := fi.Mode()
|
||||||
switch {
|
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():
|
case !fi.IsDir():
|
||||||
m["camliType"] = "file"
|
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}
|
pr := &client.PutResult{BlobRef: blobref, Size: int64(len(json)), Skipped: false}
|
||||||
return pr, nil
|
return pr, nil
|
||||||
}
|
}
|
||||||
case mode&os.ModeSymlink != 0:
|
|
||||||
if err = schema.PopulateSymlinkMap(m, filename); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
case fi.IsDir():
|
case fi.IsDir():
|
||||||
ss := new(schema.StaticSet)
|
ss := new(schema.StaticSet)
|
||||||
dir, err := os.Open(filename)
|
dir, err := os.Open(filename)
|
||||||
|
@ -310,15 +319,6 @@ func (up *Uploader) UploadFile(filename string, rollSplits bool) (respr *client.
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
schema.PopulateDirectoryMap(m, sspr.BlobRef)
|
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)
|
mappr, err := up.UploadMap(m)
|
||||||
|
|
Loading…
Reference in New Issue