aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <>2021-07-25 13:49:05 -0700
committerFChannel <>2021-07-25 13:49:05 -0700
commit74b29610d09b05b3f563bb84e8ec65b534c2ee83 (patch)
tree7beb143edce67816fc6b3d7663df8e3960c750fb /main.go
parentdef81637bc3d9f7ff73fed2786dbaa7a78086799 (diff)
added modification to media ban
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)