Add a hidden flag to disable on the spot image encoding.
Update README.
This commit is contained in:
parent
e9cf06a5f2
commit
e845dbe5a5
|
@ -37,7 +37,7 @@ Other modern features like alerts, likes, advanced dashboard with live stats (CP
|
|||
|
||||
# Requirements
|
||||
|
||||
Go 1.11 or newer - You will need to install this. Pick the .msi, if you want everything sorted out for you rather than having to go around updating the environment settings. https://golang.org/doc/install
|
||||
Go 1.12 or newer - You will need to install this. Pick the .msi, if you want everything sorted out for you rather than having to go around updating the environment settings. https://golang.org/doc/install
|
||||
|
||||
For Ubuntu, you can consult: https://tecadmin.net/install-go-on-ubuntu/
|
||||
You will also want to run `ln -s /usr/local/go/bin/go` (replace /usr/local with where ever you put Go), so that go becomes visible to other users.
|
||||
|
|
|
@ -450,6 +450,7 @@ func uploadFilesWithHash(w http.ResponseWriter, r *http.Request, user c.User, di
|
|||
if len(files) > 5 {
|
||||
return nil, c.LocalError("You can't attach more than five files", w, r, user)
|
||||
}
|
||||
disableEncode := r.PostFormValue("ko") == "1"
|
||||
|
||||
for _, file := range files {
|
||||
if file.Filename == "" {
|
||||
|
@ -495,7 +496,7 @@ func uploadFilesWithHash(w http.ResponseWriter, r *http.Request, user c.User, di
|
|||
}
|
||||
defer inFile.Close()
|
||||
|
||||
if ext != "jpg" && ext != "jpeg" && ext != "png" && ext != "gif" && ext != "tiff" && ext != "tif" {
|
||||
if disableEncode || (ext != "jpg" && ext != "jpeg" && ext != "png" && ext != "gif" && ext != "tiff" && ext != "tif") {
|
||||
outFile, err := os.Create(dir + filename)
|
||||
if err != nil {
|
||||
return nil, c.LocalError("Upload failed [File Creation Failed]", w, r, user)
|
||||
|
|
Loading…
Reference in New Issue