mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-06 11:46:24 -07:00
Remove no longer used request and writer args from file ban functions
This commit is contained in:
parent
a0c0466725
commit
fb2e68c767
2 changed files with 5 additions and 6 deletions
|
@ -77,7 +77,7 @@ func AttachUploadFromRequest(request *http.Request, writer http.ResponseWriter,
|
|||
return nil, ErrUnsupportedFileExt
|
||||
}
|
||||
|
||||
if err = CheckFilenameBan(upload, post, postBoard, writer, request); err != nil {
|
||||
if err = CheckFilenameBan(upload, post, postBoard); err != nil {
|
||||
// If checkFilenameBan returns true, an error occured or the file was
|
||||
// rejected for having a banned filename, and the incident was logged either way
|
||||
return nil, err
|
||||
|
@ -92,7 +92,7 @@ func AttachUploadFromRequest(request *http.Request, writer http.ResponseWriter,
|
|||
|
||||
// Calculate image checksum
|
||||
upload.Checksum = fmt.Sprintf("%x", md5.Sum(data)) // skipcq: GSC-G401
|
||||
if err = CheckFileChecksumBan(upload, post, postBoard, writer, request); err != nil {
|
||||
if err = CheckFileChecksumBan(upload, post, postBoard); err != nil {
|
||||
// If CheckFileChecksumBan returns a non-nil error, an error occured or the file was
|
||||
// rejected for having a banned checksum, and the incident was logged either way
|
||||
return nil, err
|
||||
|
@ -143,7 +143,7 @@ func AttachUploadFromRequest(request *http.Request, writer http.ResponseWriter,
|
|||
}
|
||||
|
||||
if err = uploadHandler(upload, post, postBoard.Dir, filePath, thumbPath, catalogThumbPath, infoEv, accessEv, errEv); err != nil {
|
||||
return nil, errors.New("error processing upload:" + err.Error())
|
||||
return nil, errors.New("error processing upload: " + err.Error())
|
||||
}
|
||||
accessEv.Send()
|
||||
return upload, nil
|
||||
|
|
|
@ -2,7 +2,6 @@ package uploads
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/gochan-org/gochan/pkg/gcsql"
|
||||
"github.com/gochan-org/gochan/pkg/gcutil"
|
||||
|
@ -14,7 +13,7 @@ var (
|
|||
ErrFileNotAllowed = errors.New("uploaded file not allowed")
|
||||
)
|
||||
|
||||
func CheckFilenameBan(upload *gcsql.Upload, post *gcsql.Post, postBoard *gcsql.Board, writer http.ResponseWriter, request *http.Request) error {
|
||||
func CheckFilenameBan(upload *gcsql.Upload, post *gcsql.Post, postBoard *gcsql.Board) error {
|
||||
filenameBan, err := gcsql.CheckFilenameBan(upload.OriginalFilename, postBoard.ID)
|
||||
if err != nil {
|
||||
gcutil.LogError(err).
|
||||
|
@ -33,7 +32,7 @@ func CheckFilenameBan(upload *gcsql.Upload, post *gcsql.Post, postBoard *gcsql.B
|
|||
return ErrFilenameNotAllowed
|
||||
}
|
||||
|
||||
func CheckFileChecksumBan(upload *gcsql.Upload, post *gcsql.Post, postBoard *gcsql.Board, writer http.ResponseWriter, request *http.Request) error {
|
||||
func CheckFileChecksumBan(upload *gcsql.Upload, post *gcsql.Post, postBoard *gcsql.Board) error {
|
||||
fileBan, err := gcsql.CheckFileChecksumBan(upload.Checksum, postBoard.ID)
|
||||
if err != nil {
|
||||
gcutil.LogError(err).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue