Raise on missing file upload instead of silently returning
change
commit 49cfde825bcc712ad7c6d2ae7efaba1aba02ea1d
author Alpha Chen <alpha@kejadlen.dev>
date
parent 48f3a660
diff --git a/lib/web.rb b/lib/web.rb
index a0861d6..8a5ae9f 100644
--- a/lib/web.rb
+++ b/lib/web.rb
@@ -39,7 +39,7 @@ module Domus
 
     def save_document(params)
       upload = params["file"]
-      return unless upload.is_a?(Hash) && upload[:tempfile]
+      raise ArgumentError, "missing file upload" unless upload.is_a?(Hash) && upload[:tempfile]
 
       ext = File.extname(upload[:filename].to_s)
       filename = "#{Time.now.strftime("%Y%m%d%H%M%S%L")}#{ext}"