mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-02-13 13:59:49 +02:00
bugfix: mod-upload broke mods
This commit is contained in:
parent
e1b2a017d4
commit
caba55241b
@ -10,6 +10,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Mods struct {
|
||||
@ -164,7 +165,9 @@ func (mods *Mods) downloadMod(url string, filename string, mod_id string) (error
|
||||
func (mods *Mods) uploadMod(header *multipart.FileHeader) (error) {
|
||||
var err error
|
||||
|
||||
if header.Header.Get("Content-Type") != "application/zip" {
|
||||
log.Printf("filename of the uploaded file: %s", header.Filename)
|
||||
|
||||
if filepath.Ext(header.Filename) != ".zip" {
|
||||
log.Print("The uploaded file wasn't a zip-file -> ignore it")
|
||||
return nil //simply do nothing xD
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func factorioLogin(username string, password string) (string, error, int) {
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Println("error Statuscode not 200")
|
||||
return body_string, errors.New("Statuscode not 200"), resp.StatusCode
|
||||
return body_string, errors.New(body_string), resp.StatusCode
|
||||
}
|
||||
|
||||
var success_response []string
|
||||
|
@ -13,6 +13,9 @@ class ModUpload extends React.Component {
|
||||
allowedFileExtensions: ['zip'],
|
||||
browseLabel: "Select Mods...",
|
||||
browseIcon: '<i class="fa fa-upload text-muted" style="color: white;"></i> ',
|
||||
slugCallback: function(filename) {
|
||||
return filename;
|
||||
},
|
||||
}).on('filebatchuploadsuccess fileuploaded', this.props.uploadModSuccessHandler);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user