From 2cf01a36bd3676095e5140cec4f5cce8f8f43003 Mon Sep 17 00:00:00 2001
From: Robert Butora <robert.butora@inaf.it>
Date: Mon, 12 May 2025 10:39:53 +0200
Subject: [PATCH] disables download of complete fitsfile/hdu when no filtering
 params given (only ID)

---
 .../servlet/src/main/java/cutout/webapi/ServletCutout.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java b/data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java
index 630cb6c..846fb16 100644
--- a/data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java
+++ b/data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java
@@ -263,6 +263,13 @@ public class ServletCutout extends HttpServlet
             Pol    pol  = Pol.parsePol(params);
             String pixels = SingleStringParam.parseSingleStringParam(params, "PIXELS");
 
+            // disable complete file/hdu download
+            if( (id!=null) && (pos==null) && (band==null) && (time==null) && (pol==null)
+                && (pixels==null))
+				{
+               throw new IllegalArgumentException("At least one of filtering args must be given.");
+				}
+
             String respFormat = sodaReq_getResponseFormat(request, DEFAULT_RESPONSEFORMAT);
 
             LOGGER.finest("responseFormat: " + respFormat);
-- 
GitLab