[#148] Use base name as FileName attribute value

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-11-05 16:58:30 +03:00 committed by Alex Vanin
parent 54818d5a11
commit 64caa15556

View file

@ -10,6 +10,7 @@ import (
"io/ioutil" "io/ioutil"
"math" "math"
"os" "os"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -494,7 +495,7 @@ func parseObjectAttrs(cmd *cobra.Command) ([]*object.Attribute, error) {
disableFilename, _ := cmd.Flags().GetBool("disable-filename") disableFilename, _ := cmd.Flags().GetBool("disable-filename")
if !disableFilename { if !disableFilename {
filename := cmd.Flag("file").Value.String() filename := filepath.Base(cmd.Flag("file").Value.String())
attr := object.NewAttribute() attr := object.NewAttribute()
attr.SetKey(object.AttributeFileName) attr.SetKey(object.AttributeFileName)
attr.SetValue(filename) attr.SetValue(filename)