Skip to content

Commit ab4a494

Browse files
fix: code resposne
1 parent 14b2f12 commit ab4a494

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434
log.Fatalf("Failed to parse input %v", err)
3535
}
3636

37-
if source_map_kv["scheme"] == "ftp" && destination_map_kv["scheme"] == "ftp" {
37+
if utils.SchemeValidator(source_map_kv["scheme"], destination_map_kv["scheme"], "ftp") {
3838
log.Println("Source and Destination are ftp endpoints")
3939

4040
// validate ftp parameters : panic on failure
@@ -45,7 +45,7 @@ func main() {
4545

4646
utils.FtpClientHandler(source_map_kv, destination_map_kv, bsvalue)
4747
}
48-
if source_map_kv["scheme"] == "sftp" && destination_map_kv["scheme"] == "sftp" {
48+
if utils.SchemeValidator(source_map_kv["scheme"], destination_map_kv["scheme"], "sftp") {
4949
log.Println("Source and Destination are ftp endpoints")
5050

5151
// validate ftp parameters : panic on failure

utils/parsers.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ func NullChecker(key string, ftpurl string) {
4747
}
4848
}
4949

50-
func SchemeValidator(scheme string) bool {
51-
log.Printf("scheme: %s", scheme)
52-
if scheme == "ftp" {
53-
return true
50+
func SchemeValidator(source, dest, key string) bool {
51+
if source == dest {
52+
if source == key {
53+
return true
54+
}
5455
}
5556
return false
5657
}

0 commit comments

Comments
 (0)