Skip to content

Commit

Permalink
solved complexed issue
Browse files Browse the repository at this point in the history
Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>
  • Loading branch information
viveksahu26 committed Sep 15, 2022
1 parent 12d1568 commit f8c38a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/saveInfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func IsLongURLPresentInFile(fileName, longURL string) (map[string]string, string
}
fileContent := strings.Split(string(fileBytes), "\n")

var fileContainLongURL bool
fileContainLongURL := false
var message string
ShortAndLongURLValue := make(map[string]string)
for _, line := range fileContent {
Expand All @@ -58,7 +58,7 @@ func IsLongURLPresentInFile(fileName, longURL string) (map[string]string, string
ShortAndLongURLValue[totalURL[1]] = totalURL[0]
}

if strings.Contains(line, longURL) {
if strings.HasSuffix(line, longURL) {
message = fmt.Sprintln("Yes, URL is already present in the file")
fileContainLongURL = true
return ShortAndLongURLValue, message, fileContainLongURL
Expand Down

0 comments on commit f8c38a2

Please sign in to comment.