Use io instead of deprecated ioutil
This commit is contained in:
parent
5453c09420
commit
64ba6932f7
1 changed files with 2 additions and 3 deletions
|
|
@ -27,7 +27,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
@ -140,7 +139,7 @@ func serveOrReverse(forced_url string, cfg *config.Config) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v, _ := ioutil.ReadAll(resp.Body)
|
v, _ := io.ReadAll(resp.Body)
|
||||||
|
|
||||||
v2 := strings.Replace(strings.Replace(string(v), "</head>", `{{ .Head }}<meta property="og:url" content="{{ .RootURL }}"></head>`, 1), "</body>", "{{ .Body }}</body>", 1)
|
v2 := strings.Replace(strings.Replace(string(v), "</head>", `{{ .Head }}<meta property="og:url" content="{{ .RootURL }}"></head>`, 1), "</body>", "{{ .Body }}</body>", 1)
|
||||||
|
|
||||||
|
|
@ -167,7 +166,7 @@ func serveOrReverse(forced_url string, cfg *config.Config) gin.HandlerFunc {
|
||||||
if indexTpl == nil {
|
if indexTpl == nil {
|
||||||
// Create template from file
|
// Create template from file
|
||||||
f, _ := Assets.Open("index.html")
|
f, _ := Assets.Open("index.html")
|
||||||
v, _ := ioutil.ReadAll(f)
|
v, _ := io.ReadAll(f)
|
||||||
|
|
||||||
v2 := strings.Replace(strings.Replace(string(v), "</head>", `{{ .Head }}<meta property="og:url" content="{{ .RootURL }}"></head>`, 1), "</body>", "{{ .Body }}</body>", 1)
|
v2 := strings.Replace(strings.Replace(string(v), "</head>", `{{ .Head }}<meta property="og:url" content="{{ .RootURL }}"></head>`, 1), "</body>", "{{ .Body }}</body>", 1)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue