diff --git a/data/datasets/testdata+001.nc b/data/datasets/testdata+001.nc new file mode 100644 index 00000000..e16b3603 Binary files /dev/null and b/data/datasets/testdata+001.nc differ diff --git a/python/python_fastapi_server/routers/wmswcs.py b/python/python_fastapi_server/routers/wmswcs.py index c871fec8..b9f7e93f 100644 --- a/python/python_fastapi_server/routers/wmswcs.py +++ b/python/python_fastapi_server/routers/wmswcs.py @@ -39,7 +39,9 @@ async def handle_wms(req: Request, ): if len(param_parts) == 2 and param_parts[0].upper() == "DATASET": query_string += f"&{param_parts[0]}={param_parts[1]}" else: - query_string += f"&{k}={req.query_params[k]}" + query_param=req.query_params[k] + query_param = query_param.replace('+', '%2B') + query_string += f"&{k}={query_param}" # Run adaguc-server status, data, headers = adaguc_instance.runADAGUCServer(query_string, diff --git a/tests/AdagucTests/TestWMS.py b/tests/AdagucTests/TestWMS.py index df029a35..7babe1d2 100644 --- a/tests/AdagucTests/TestWMS.py +++ b/tests/AdagucTests/TestWMS.py @@ -101,6 +101,22 @@ def test_WMSGetMap_testdatanc(self): data.getvalue(), AdagucTestTools().readfromfile(self.expectedoutputsspath + filename)) + def test_WMSGetMap_testdatanc_withplus(self): + AdagucTestTools().cleanTempDir() + filename = "test_WMSGetMap_testdatanc_plus.png" + # pylint: disable=unused-variable + status, data, headers = AdagucTestTools().runADAGUCServer( + "source=testdata%2B001.nc&SERVICE=WMS&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&LAYERS=testdata&WIDTH=256&HEIGHT=256&CRS=EPSG%3A4326&BBOX=30,-30,75,30&STYLES=testdata%2Fnearest&FORMAT=image/png&TRANSPARENT=FALSE&", + env=self.env, + args=["--report"]) + AdagucTestTools().writetofile(self.testresultspath + filename, + data.getvalue()) + self.assertEqual(status, 0) + self.assertEqual( + data.getvalue(), + AdagucTestTools().readfromfile(self.expectedoutputsspath + + filename)) + def test_WMSGetMap_geos(self): AdagucTestTools().cleanTempDir() diff --git a/tests/expectedoutputs/TestWMS/test_WMSGetMap_testdatanc_plus.png b/tests/expectedoutputs/TestWMS/test_WMSGetMap_testdatanc_plus.png new file mode 100644 index 00000000..a7a3e9c2 Binary files /dev/null and b/tests/expectedoutputs/TestWMS/test_WMSGetMap_testdatanc_plus.png differ