Skip to content

Commit

Permalink
fix writing put target path without folder prefix writes to current f…
Browse files Browse the repository at this point in the history
…older (#228)

- **FIXED** put with --target-path without folder in path (local or absolute) now writes to current folder instead of root
  • Loading branch information
DanEngelbrecht authored Sep 2, 2022
1 parent 625b671 commit fcaf8c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- **FIXED** Corrected some function names logging
- **FIXED** splitURI handles mixed forward and backward slash better
- **FIXED** Reduced memory consumption when doing downsync/get of version
- **FIXED** `put` with `--target-path` without folder in path (local or absolute) now writes to current folder instead of root
- **UPDATED** Updated longtail to 0.3.6

## v0.3.5
Expand Down
2 changes: 1 addition & 1 deletion commands/cmd_put.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func put(
timeStats := []longtailutils.TimeStat{}

targetName := targetPath
parentPath := ""
parentPath := "."
pathDelimiter := strings.LastIndexAny(targetPath, "\\/")
if pathDelimiter != -1 {
parentPath = targetPath[0:pathDelimiter]
Expand Down
7 changes: 6 additions & 1 deletion longtailutils/longtailutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ func splitURI(uri string) (string, string) {
if i == -1 {
return "", uri
}
return uri[:i], uri[i+1:]
parent := uri[:i]
name := uri[i+1:]
if parent == "" && (uri[0] == '\\' || uri[0] == '/') {
parent = "/"
}
return parent, name
}

// ReadFromURI ...
Expand Down

0 comments on commit fcaf8c3

Please sign in to comment.