Commit Diff
Commit:
657af0a4f7c94d3c3b4d222b9b8b2803364b4537
Date:
Sun Jul 3 08:36:57 2022
UTC
Message
chmod downloaded files as 0644
while here also switch ioutil.TempFile to os.CreateTemp (which is now
the same)
--- main.go
+++ main.go
@@ -5,9 +5,9 @@ import (
"flag"
"fmt"
"io"
- "io/ioutil"
"log"
"net/http"
+ "os"
"path"
"path/filepath"
"regexp"
@@ -50,13 +50,15 @@ func matrix2gemini(conn *irc.Conn, line *irc.Line) {
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(
Omar Polo