Browse Source

Change PostImages upload limit to bitwise operation

feature/post-fk-cruds
Tovi Jaeschke-Rogers 3 years ago
parent
commit
e6be47aaa5
7 changed files with 7 additions and 3 deletions
  1. +1
    -0
      Api/PostHelper.go
  2. +2
    -2
      Api/PostImages.go
  3. +1
    -1
      Api/PostImages_test.go
  4. +1
    -0
      Api/Posts.go
  5. +1
    -0
      Api/Posts_test.go
  6. BIN
      Api/test.jpg
  7. +1
    -0
      Database/PostImages.go

+ 1
- 0
Api/PostHelper.go View File

@ -7,6 +7,7 @@ import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )


+ 2
- 2
Api/PostImages.go View File

@ -10,6 +10,7 @@ import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Util" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Util"
"github.com/gofrs/uuid" "github.com/gofrs/uuid"
) )
@ -38,8 +39,7 @@ func createPostImage(w http.ResponseWriter, r *http.Request) {
postUUID = uuid.FromStringOrNil(postID) postUUID = uuid.FromStringOrNil(postID)
// TODO: Change arg to bitwise op
err = r.ParseMultipartForm(200000)
err = r.ParseMultipartForm(20 << 20)
if err != nil { if err != nil {
log.Printf("Error encountered parsing multipart form: %s\n", err.Error()) log.Printf("Error encountered parsing multipart form: %s\n", err.Error())
JsonReturn(w, 500, "An error occured") JsonReturn(w, 500, "An error occured")


+ 1
- 1
Api/PostImages_test.go View File

@ -20,9 +20,9 @@ import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"gorm.io/gorm"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"gorm.io/gorm"
) )
func init() { func init() {


+ 1
- 0
Api/Posts.go View File

@ -11,6 +11,7 @@ import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Api/JsonSerialization" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Api/JsonSerialization"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"github.com/gorilla/mux" "github.com/gorilla/mux"
) )


+ 1
- 0
Api/Posts_test.go View File

@ -15,6 +15,7 @@ import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Database"
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"github.com/gorilla/mux" "github.com/gorilla/mux"
"gorm.io/gorm" "gorm.io/gorm"
) )


BIN
Api/test.jpg View File

Before After
Width: 3840  |  Height: 2160  |  Size: 1.7 MiB

+ 1
- 0
Database/PostImages.go View File

@ -2,6 +2,7 @@ package Database
import ( import (
"git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models" "git.tovijaeschke.xyz/tovi/SuddenImpactRecords/Models"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/clause" "gorm.io/gorm/clause"
) )


Loading…
Cancel
Save