diff options
-rw-r--r-- | main.go | 13 | ||||
-rw-r--r-- | outboxPost.go | 9 | ||||
-rw-r--r-- | static/faq.html | 2 |
3 files changed, 17 insertions, 7 deletions
@@ -804,9 +804,14 @@ func main() { f, err := os.Open("." + file) CheckError(err, "could not open attachment for ban media") - defer f.Close() - bytes, err := ioutil.ReadAll(f) - CheckError(err, "could not get attachment bytes for ban media") + defer f.Close() + + bytes := make([]byte, 2048) + + _, err = f.Read(bytes) + if err != nil { + fmt.Println("error readin bytes for setting media ban") + } if !IsMediaBanned(db, f) { query := `insert into bannedmedia (hash) values ($1)` @@ -1974,7 +1979,7 @@ func MakeCaptchas(db *sql.DB, total int) { } func GetFileContentType(out multipart.File) (string, error) { - + buffer := make([]byte, 512) _, err := out.Read(buffer) diff --git a/outboxPost.go b/outboxPost.go index 88b9927..6d23e23 100644 --- a/outboxPost.go +++ b/outboxPost.go @@ -637,8 +637,13 @@ func MakeActivityFollowingReq(w http.ResponseWriter, r *http.Request, activity A func IsMediaBanned(db *sql.DB, f multipart.File) bool { f.Seek(0, 0) - - fileBytes, _ := ioutil.ReadAll(f) + + fileBytes := make([]byte, 2048) + + _, err := f.Read(fileBytes) + if err != nil { + fmt.Println("error readin bytes for media ban") + } hash := HashBytes(fileBytes) diff --git a/static/faq.html b/static/faq.html index 6f60d62..c389066 100644 --- a/static/faq.html +++ b/static/faq.html @@ -56,7 +56,7 @@ <p>Soon™.</p> <h4 id="version">What version is this FChannel instance?</h4> - <p>v0.0.12-dev</p> + <p>v0.0.13-dev</p> </div> <div style="width: 500px; margin:0 auto; margin-top: 50px; text-align: center;"> <a href="/">[Home]</a><a href="/static/rules.html">[Rules]</a><a href="/static/faq.html">[FAQ]</a> |