commit - 56842f402accf4705a52d66c041212dced2a3039
commit + 657af0a4f7c94d3c3b4d222b9b8b2803364b4537
blob - 9619cce7060f38cc4a5be670bf55523b678ccb97
blob + 5584bb39dbf04164a9db6aa4f903251691b726fe
--- main.go
+++ main.go
"flag"
"fmt"
"io"
- "io/ioutil"
"log"
"net/http"
+ "os"
"path"
"path/filepath"
"regexp"
defer resp.Body.Close()
ext := path.Ext(link)
- tmpfile, err := ioutil.TempFile(*matrixOutDir, "message-*"+ext)
+ tmpfile, err := os.CreateTemp(*matrixOutDir, "message-*"+ext)
if err != nil {
conn.Privmsg(channel, fmt.Sprintf("failed to tmpfile: %s", err))
return
}
defer tmpfile.Close()
+ os.Chmod(tmpfile.Name(), 0644)
+
io.Copy(tmpfile, resp.Body)
conn.Privmsg(