Skip to content

Commit 4b92695

Browse files
Tanq16Tanq16
authored andcommitted
minor update
1 parent 2d95778 commit 4b92695

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

utils/functions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func DetermineDownloadType(url string) string {
2727
return "gdrive"
2828
} else if strings.HasPrefix(url, "s3://") {
2929
return "s3"
30-
} else if strings.HasPrefix(url, "https://youtu.be") || strings.HasPrefix(url, "https://www.youtube.com") {
30+
} else if strings.HasPrefix(url, "https://youtu.be") || strings.HasPrefix(url, "https://www.youtube.com") || strings.HasPrefix(url, "https://music.youtube.com") {
3131
return "youtube"
3232
} else if strings.HasPrefix(url, "ftp://") || strings.HasPrefix(url, "ftps://") {
3333
return "ftp"

utils/output-manager.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,17 @@ func PrintProgressBar(current, total int64, width int) string {
423423
if width <= 0 {
424424
width = 30
425425
}
426+
if total <= 0 {
427+
total = 1
428+
}
429+
if current < 0 {
430+
current = 0
431+
}
432+
if current > total {
433+
current = total
434+
}
426435
percent := float64(current) / float64(total)
427-
filled := min(int(percent*float64(width)), width)
436+
filled := max(0, min(int(percent*float64(width)), width))
428437
bar := StyleSymbols["bullet"]
429438
bar += strings.Repeat(StyleSymbols["hline"], filled)
430439
if filled < width {

0 commit comments

Comments
 (0)