Skip to content

Commit ec9f2a0

Browse files
committed
🔥 done
1 parent e6a0051 commit ec9f2a0

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Whitespace-only changes.

go-tdm

8.52 MB
Binary file not shown.

metadata/meta.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package metadata
2+
3+
import (
4+
"mime"
5+
"net/http"
6+
"path/filepath"
7+
)
8+
9+
func GetFileName(resp *http.Response) string {
10+
contentDisposition := resp.Header.Get("Content-Disposition")
11+
if contentDisposition != "" {
12+
_, params, err := mime.ParseMediaType(contentDisposition)
13+
14+
if err != nil {
15+
panic(err)
16+
}
17+
return params["filename"]
18+
}
19+
filename := filepath.Base(resp.Request.URL.Path)
20+
return filename
21+
}

0 commit comments

Comments
 (0)