mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-05 00:33:47 +08:00
fix: fixed bug for generating the upload file path
This commit is contained in:
@@ -3,11 +3,15 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path"
|
||||
)
|
||||
|
||||
func main() {
|
||||
parse, _ := url.Parse("http://localhost:5678/static")
|
||||
imgURL := "https://www.baidu.com/static/upload/2023/10/1696497571220711277.png?ex=6530f4a2&is=651e7fa28hmFd709d069ca05d7855ebdae42e5aa436883a36f9310d546"
|
||||
parse, err := url.Parse(imgURL)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
imgURLPrefix := fmt.Sprintf("%s://%s", parse.Scheme, parse.Host)
|
||||
fmt.Println(imgURLPrefix)
|
||||
fmt.Println(path.Ext(parse.Path))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user