18947: Bring back keepproxy systemd unit file.
[arvados.git] / services / keep-web / s3.go
index 357c42ae6caee6e84f15c2c20d0f2ac754caa911..5af7ebb5d52cfe17022ce46ed1e50fed507ca93f 100644 (file)
@@ -406,11 +406,11 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
                }
 
                tokenUser, err := h.Config.Cache.GetTokenUser(token)
-               if !h.UserPermittedToUploadOrDownload(r.Method, tokenUser) {
+               if !h.userPermittedToUploadOrDownload(r.Method, tokenUser) {
                        http.Error(w, "Not permitted", http.StatusForbidden)
                        return true
                }
-               h.LogUploadOrDownload(r, arvclient, fs, fspath, nil, tokenUser)
+               h.logUploadOrDownload(r, arvclient, fs, fspath, nil, tokenUser)
 
                // shallow copy r, and change URL path
                r := *r
@@ -471,7 +471,7 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
                                        return true
                                }
                                err = fs.Mkdir(dir, 0755)
-                               if err == arvados.ErrInvalidArgument {
+                               if errors.Is(err, arvados.ErrInvalidArgument) || errors.Is(err, arvados.ErrInvalidOperation) {
                                        // Cannot create a directory
                                        // here.
                                        err = fmt.Errorf("mkdir %q failed: %w", dir, err)
@@ -497,11 +497,11 @@ func (h *handler) serveS3(w http.ResponseWriter, r *http.Request) bool {
                        defer f.Close()
 
                        tokenUser, err := h.Config.Cache.GetTokenUser(token)
-                       if !h.UserPermittedToUploadOrDownload(r.Method, tokenUser) {
+                       if !h.userPermittedToUploadOrDownload(r.Method, tokenUser) {
                                http.Error(w, "Not permitted", http.StatusForbidden)
                                return true
                        }
-                       h.LogUploadOrDownload(r, arvclient, fs, fspath, nil, tokenUser)
+                       h.logUploadOrDownload(r, arvclient, fs, fspath, nil, tokenUser)
 
                        _, err = io.Copy(f, r.Body)
                        if err != nil {