Add extension to downloaded filename
This commit is contained in:
@@ -74,3 +74,4 @@ Build and push this container to ghcr
|
||||
- [x] sort videos most to least recent
|
||||
- [x] header on playlist page
|
||||
- [x] Choose database directory
|
||||
- [x] add extension to download
|
||||
|
@@ -788,8 +788,8 @@ func makeNiceFilename(input string) string {
|
||||
}
|
||||
|
||||
// Remove any remaining non-alphanumeric characters (except underscores)
|
||||
reg := regexp.MustCompile("[^a-z0-9_\\.]+")
|
||||
input = reg.ReplaceAllString(input, "")
|
||||
reg := regexp.MustCompile("[^a-z0-9_.-]")
|
||||
input = reg.ReplaceAllString(input, "x")
|
||||
|
||||
// Trim leading/trailing underscores
|
||||
input = strings.Trim(input, "_")
|
||||
@@ -849,7 +849,7 @@ func videoHandler(c echo.Context) error {
|
||||
FPS: fmt.Sprintf("%.1f", video.FPS),
|
||||
Size: humanSize(video.Size),
|
||||
Filename: video.Filename,
|
||||
DownloadFilename: makeNiceFilename(orig.Title),
|
||||
DownloadFilename: makeNiceFilename(orig.Title + filepath.Ext(tempURL.FilePath)),
|
||||
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
||||
TempURL: tempURL,
|
||||
})
|
||||
@@ -869,7 +869,7 @@ func videoHandler(c echo.Context) error {
|
||||
Kbps: fmt.Sprintf("%.1f kbps", kbps),
|
||||
Size: humanSize(audio.Size),
|
||||
Filename: audio.Filename,
|
||||
DownloadFilename: makeNiceFilename(orig.Title),
|
||||
DownloadFilename: makeNiceFilename(orig.Title + filepath.Ext(tempURL.FilePath)),
|
||||
StreamRate: fmt.Sprintf("%.1f KiB/s", rate/1024),
|
||||
TempURL: tempURL,
|
||||
})
|
||||
|
Reference in New Issue
Block a user