I guess not every image is pikachu
This commit is contained in:
parent
2f5bb2ff36
commit
111a33bc8a
@ -14,6 +14,7 @@ import (
|
|||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -120,6 +121,8 @@ func (u *Upload) RemoveMarkupTempFile() {
|
|||||||
func (u *Upload) processUpload() error {
|
func (u *Upload) processUpload() error {
|
||||||
daulog.SendLog(fmt.Sprintf("Uploading: %s", u.OriginalFilename), daulog.LogTypeInfo)
|
daulog.SendLog(fmt.Sprintf("Uploading: %s", u.OriginalFilename), daulog.LogTypeInfo)
|
||||||
|
|
||||||
|
baseFilename := filepath.Base(u.OriginalFilename)
|
||||||
|
|
||||||
if u.webhookURL == "" {
|
if u.webhookURL == "" {
|
||||||
daulog.SendLog("WebHookURL is not configured - cannot upload!", daulog.LogTypeError)
|
daulog.SendLog("WebHookURL is not configured - cannot upload!", daulog.LogTypeError)
|
||||||
return errors.New("webhook url not configured")
|
return errors.New("webhook url not configured")
|
||||||
@ -184,7 +187,7 @@ func (u *Upload) processUpload() error {
|
|||||||
imageData = filedata
|
imageData = filedata
|
||||||
}
|
}
|
||||||
|
|
||||||
request, err := newfileUploadRequest(u.webhookURL, extraParams, "file", "pikachu.png", imageData)
|
request, err := newfileUploadRequest(u.webhookURL, extraParams, "file", baseFilename, imageData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("error creating upload request: %s", err)
|
log.Printf("error creating upload request: %s", err)
|
||||||
return fmt.Errorf("could not create upload request: %s", err)
|
return fmt.Errorf("could not create upload request: %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user