Skip to content

Commit

Permalink
Added env variable GOKAPI_DISABLE_REPLACE to displace replace feature…
Browse files Browse the repository at this point in the history
…, until user permissions are added
  • Loading branch information
Forceu committed Dec 17, 2024
1 parent c167e75 commit 2cc3609
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/webserver/api/Api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/forceu/gokapi/internal/webserver/fileupload"
"io"
"net/http"
"os"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -390,6 +391,11 @@ func replaceFile(w http.ResponseWriter, request apiRequest) {
sendError(w, http.StatusBadRequest, err.Error())
return
}
// TODO remove with 2.0 once user control has been added
if os.Getenv("GOKAPI_DISABLE_REPLACE") != "" {
sendError(w, http.StatusUnauthorized, "Replace file is disabled")
return
}
modifiedFile, err := storage.ReplaceFile(request.fileInfo.id, request.filemodInfo.idNewContent, request.filemodInfo.deleteNewFile)
if err != nil {
switch {
Expand Down

0 comments on commit 2cc3609

Please sign in to comment.