mirror of
https://github.com/tenox7/wrp.git
synced 2025-01-02 16:31:40 +00:00
fix destination bug
This commit is contained in:
parent
db77479bad
commit
a2a4152b86
5
txt.go
5
txt.go
@ -117,12 +117,13 @@ func (t *astTransformer) Transform(node *ast.Document, reader text.Reader, pc pa
|
|||||||
}
|
}
|
||||||
if img, ok := n.(*ast.Image); ok && entering {
|
if img, ok := n.(*ast.Image); ok && entering {
|
||||||
id := fmt.Sprintf("txt%05d.gif", rand.Intn(99999)) // atomic.AddInt64 could be better here
|
id := fmt.Sprintf("txt%05d.gif", rand.Intn(99999)) // atomic.AddInt64 could be better here
|
||||||
img.Destination = []byte(imgZpfx + id)
|
err := grabImage(id, string(img.Destination)) // TODO: use goroutines with waitgroup
|
||||||
err := grabImage(id, string(img.Destination)) // TODO: use goroutines with waitgroup
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
n.Parent().RemoveChildren(n)
|
n.Parent().RemoveChildren(n)
|
||||||
|
return ast.WalkContinue, nil
|
||||||
}
|
}
|
||||||
|
img.Destination = []byte(imgZpfx + id)
|
||||||
}
|
}
|
||||||
return ast.WalkContinue, nil
|
return ast.WalkContinue, nil
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user