Skip to content

Commit 57d7ebf

Browse files
committed
chore(dump): Clean up dump file/dir check
1 parent f55abc0 commit 57d7ebf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cmd/dump/cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ func preRun(cmd *cobra.Command, args []string) error {
146146
return fmt.Errorf("%w: %s", util.ErrNoDump, action.Dialect.Name())
147147
}
148148

149-
var isDir bool
150-
if action.Filename != "" {
151-
if stat, err := os.Stat(action.Filename); err == nil && stat.IsDir() {
152-
isDir = true
149+
isDir := action.Filename == "" || strings.HasSuffix(action.Filename, string(os.PathSeparator)) || storage.IsCloudDir(action.Filename)
150+
if !isDir && !storage.IsCloud(action.Filename) {
151+
if stat, err := os.Stat(action.Filename); err == nil {
152+
isDir = stat.IsDir()
153153
}
154154
}
155155

156-
if action.Filename == "" || isDir || strings.HasSuffix(action.Filename, string(os.PathSeparator)) || storage.IsCloudDir(action.Filename) {
156+
if isDir {
157157
generated := dump.Filename{
158158
Database: action.Database,
159159
Namespace: action.Client.Namespace,

0 commit comments

Comments
 (0)