5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 21:10:54 +08:00

Dedupe assetbundle

This commit is contained in:
Lea Anthony 2021-01-03 20:06:07 +11:00
parent 75e852451c
commit 1889973af1
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405

View File

@ -61,6 +61,8 @@ func (a *AssetBundle) processHTML(htmldata string) error {
buf := bytes.NewBufferString(htmldata)
tokenizer := html.NewTokenizer(buf)
paths := slicer.String()
for {
//get the next token type
tokenType := tokenizer.Next()
@ -109,7 +111,12 @@ func (a *AssetBundle) processHTML(htmldata string) error {
if err != nil {
return err
}
a.assets = append(a.assets, asset)
// Ensure we don't include duplicates
if !paths.Contains(asset.Path) {
a.assets = append(a.assets, asset)
paths.Add(asset.Path)
}
}
if "script" == token.Data {