mirror of
https://github.com/fengxxc/wechatmp2markdown.git
synced 2026-02-23 15:20:55 +08:00
v1.1.2
fix: 校验参数,解析url出错时不退出主线程
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
BUILD_ENV := CGO_ENABLED=0
|
||||
APP=wechatmp2markdown
|
||||
VERSION=v1.1.1
|
||||
VERSION=v1.1.2
|
||||
|
||||
# linux or mac 环境编译
|
||||
# make [cmd]
|
||||
|
||||
2
main.go
2
main.go
@@ -35,7 +35,7 @@ func main() {
|
||||
// --image=save -is 保存图片,最终输出到文件夹
|
||||
// --save=zip -sz 最终打包输出到zip
|
||||
imageArgValue := "base64"
|
||||
if args[3] != "" {
|
||||
if len(args) > 3 && args[3] != "" {
|
||||
if strings.HasPrefix(args[3], "--image=") {
|
||||
imageArgValue = args[3][len("--image="):]
|
||||
} else if strings.HasPrefix(args[3], "-i") {
|
||||
|
||||
@@ -196,7 +196,7 @@ func ParseFromHTMLFile(filepath string, imagePolicy ImagePolicy) Article {
|
||||
func ParseFromURL(url string, imagePolicy ImagePolicy) Article {
|
||||
res, err := http.Get(url)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
log.Fatalf(err.Error())
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode != 200 {
|
||||
|
||||
Reference in New Issue
Block a user