Revert "issue #420 return 400 response when Max-Days is too big (#422)" (#426)

This reverts commit 2959fc2992.
This commit is contained in:
Andrea Spacca 2021-10-26 19:03:51 +02:00 committed by GitHub
parent 2959fc2992
commit fa74be02d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -533,10 +533,6 @@ func (s *Server) putHandler(w http.ResponseWriter, r *http.Request) {
s.logger.Printf("%s", err.Error()) s.logger.Printf("%s", err.Error())
http.Error(w, errors.New("Could not encode metadata").Error(), 500) http.Error(w, errors.New("Could not encode metadata").Error(), 500)
return return
} else if time.Now().After(metadata.MaxDate) {
s.logger.Print("Invalid MaxDate")
http.Error(w, errors.New("Invalid MaxDate, make sure Max-Days is smaller than 290 years").Error(), 400)
return
} else if err := s.storage.Put(token, fmt.Sprintf("%s.metadata", filename), buffer, "text/json", uint64(buffer.Len())); err != nil { } else if err := s.storage.Put(token, fmt.Sprintf("%s.metadata", filename), buffer, "text/json", uint64(buffer.Len())); err != nil {
s.logger.Printf("%s", err.Error()) s.logger.Printf("%s", err.Error())
http.Error(w, errors.New("Could not save metadata").Error(), 500) http.Error(w, errors.New("Could not save metadata").Error(), 500)