aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/main.go b/main.go
index 8547efd..f5b8613 100644
--- a/main.go
+++ b/main.go
@@ -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)