mirror of
https://github.com/tenox7/wrp.git
synced 2024-11-23 01:36:13 +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 {
|
||||
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 {
|
||||
log.Print(err)
|
||||
n.Parent().RemoveChildren(n)
|
||||
return ast.WalkContinue, nil
|
||||
}
|
||||
img.Destination = []byte(imgZpfx + id)
|
||||
}
|
||||
return ast.WalkContinue, nil
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user