Skip to content

Commit

Permalink
Use correct key for looking up file name
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 committed Nov 2, 2020
1 parent 698683f commit 4ba631a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/storage/fs/ocis/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (fs *ocisfs) Upload(ctx context.Context, ref *provider.Reference, r io.Read

uploadInfo := upload.(*fileUpload)

p := uploadInfo.info.Storage["InternalDestination"]
p := uploadInfo.info.Storage["NodeName"]
ok, err := chunking.IsChunked(p)
if err != nil {
return errors.Wrap(err, "ocfs: error checking path")
Expand Down Expand Up @@ -358,6 +358,7 @@ func (upload *fileUpload) writeInfo() error {

// FinishUpload finishes an upload and moves the file to the internal destination
func (upload *fileUpload) FinishUpload(ctx context.Context) (err error) {
log := appctx.GetLogger(upload.ctx)

n := &Node{
lu: upload.fs.lu,
Expand All @@ -370,8 +371,6 @@ func (upload *fileUpload) FinishUpload(ctx context.Context) (err error) {
n.ID = uuid.New().String()
}
targetPath := upload.fs.lu.toInternalPath(n.ID)
log := appctx.GetLogger(upload.ctx)
log.Info().Msgf("targetPath: %+v, ID: %+v", targetPath, n.ID)

// if target exists create new version
var fi os.FileInfo
Expand All @@ -380,7 +379,6 @@ func (upload *fileUpload) FinishUpload(ctx context.Context) (err error) {
versionsPath := upload.fs.lu.toInternalPath(n.ID + ".REV." + fi.ModTime().UTC().Format(time.RFC3339Nano))

if err = os.Rename(targetPath, versionsPath); err != nil {
log := appctx.GetLogger(upload.ctx)
log.Err(err).Interface("info", upload.info).
Str("binPath", upload.binPath).
Str("targetPath", targetPath).
Expand Down

0 comments on commit 4ba631a

Please sign in to comment.