Skip to content

Commit

Permalink
clarify FileSystem.Save code
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Jan 25, 2020
1 parent 266791b commit e4c4934
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/app/store/image/fs_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ func (f *FileSystem) SaveWithID(id string, r io.Reader) (string, error) {
// Save data from a reader for given file name to local FS, staging directory. Returns id as user/uuid
// Files partitioned across multiple subdirectories, and the final path includes part, i.e. /location/user1/03/123-4567
func (f *FileSystem) Save(fileName string, userID string, r io.Reader) (id string, err error) {
id = path.Join(userID, guid()) // make id as user/uuid
finalID, err := f.SaveWithID(id, r)
tempId := path.Join(userID, guid()) // make id as user/uuid
id, err = f.SaveWithID(tempId, r)
if err != nil {
err = errors.Wrapf(err, "can't save file %s", fileName)
}
return finalID, err
return id, err
}

// Commit file stored in staging location by moving it to permanent location
Expand Down

0 comments on commit e4c4934

Please sign in to comment.