Skip to content

Commit 590e449

Browse files
Merge branch 'master' of github.com:GeoNode/geonode into ISSUE_13010
2 parents 7fcbe58 + 180d0a2 commit 590e449

File tree

9 files changed

+41
-16
lines changed

9 files changed

+41
-16
lines changed

create-envfile.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@ def shuffle(chars):
4242
random.shuffle(chars_as_list)
4343
return "".join(chars_as_list)
4444

45-
4645
_simple_chars = shuffle(string.ascii_letters + string.digits)
47-
_strong_chars = shuffle(
48-
string.ascii_letters + string.digits + string.punctuation.replace('"', "").replace("'", "").replace("`", "")
49-
)
50-
46+
_strong_chars = shuffle(string.ascii_letters + string.digits + "#%*._~")
5147

5248
def generate_env_file(args):
5349
# validity checks

docker-compose-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ services:
9292

9393
# Geoserver backend
9494
geoserver:
95-
image: geonode/geoserver:2.24.3-latest
95+
image: geonode/geoserver:2.24.4-latest
9696
container_name: geoserver4${COMPOSE_PROJECT_NAME}
9797
healthcheck:
9898
test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://geoserver:8080/geoserver/ows"
@@ -118,7 +118,7 @@ services:
118118
condition: service_healthy
119119

120120
data-dir-conf:
121-
image: geonode/geoserver_data:2.24.3-latest
121+
image: geonode/geoserver_data:2.24.4-latest
122122
container_name: gsconf4${COMPOSE_PROJECT_NAME}
123123
entrypoint: sleep infinity
124124
volumes:

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ services:
9191

9292
# Geoserver backend
9393
geoserver:
94-
image: geonode/geoserver:2.24.3-latest
94+
image: geonode/geoserver:2.24.4-latest
9595
container_name: geoserver4${COMPOSE_PROJECT_NAME}
9696
healthcheck:
9797
test: "curl -m 10 --fail --silent --write-out 'HTTP CODE : %{http_code}\n' --output /dev/null http://geoserver:8080/geoserver/ows"
@@ -117,7 +117,7 @@ services:
117117
condition: service_healthy
118118

119119
data-dir-conf:
120-
image: geonode/geoserver_data:2.24.3-latest
120+
image: geonode/geoserver_data:2.24.4-latest
121121
container_name: gsconf4${COMPOSE_PROJECT_NAME}
122122
entrypoint: sleep infinity
123123
volumes:

geonode/base/api/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,16 @@ def set_thumbnail_from_bbox(self, request, resource_id, *args, **kwargs):
680680
try:
681681
resource = ResourceBase.objects.get(id=ast.literal_eval(resource_id))
682682

683+
map_thumb_from_bbox = False
684+
if isinstance(resource.get_real_instance(), Map):
685+
map_thumb_from_bbox = True
686+
683687
if not isinstance(resource.get_real_instance(), (Dataset, Map)):
684688
raise NotImplementedError("Not implemented: Endpoint available only for Dataset and Maps")
685689

686690
request_body = request.data if request.data else json.loads(request.body)
687691
try:
692+
# bbox format: (xmin, xmax, ymin, ymax)
688693
bbox = request_body["bbox"] + [request_body["srid"]]
689694
zoom = request_body.get("zoom", None)
690695
except MultiValueDictKeyError:
@@ -695,7 +700,11 @@ def set_thumbnail_from_bbox(self, request, resource_id, *args, **kwargs):
695700
zoom = request_body.get("zoom", None)
696701

697702
thumbnail_url = create_thumbnail(
698-
resource.get_real_instance(), bbox=bbox, background_zoom=zoom, overwrite=True
703+
resource.get_real_instance(),
704+
bbox=bbox,
705+
background_zoom=zoom,
706+
overwrite=True,
707+
map_thumb_from_bbox=map_thumb_from_bbox,
699708
)
700709
return Response(
701710
{"message": "Thumbnail correctly created.", "success": True, "thumbnail_url": thumbnail_url}, status=200

geonode/documents/migrations/0037_delete_documentresourcelink.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ class Migration(migrations.Migration):
1111

1212
operations = [
1313
migrations.RunSQL(
14-
"INSERT INTO base_linkedresource(source_id, target_id, internal)"
14+
"INSERT INTO base_linkedresource(source_id, target_id, internal) "
1515
"SELECT document_id, object_id, false as internal "
16-
"FROM documents_documentresourcelink;"
16+
"FROM documents_documentresourcelink "
17+
"WHERE EXISTS (SELECT 1 FROM base_resourcebase base WHERE base.id=object_id);"
1718
),
1819
migrations.DeleteModel(
1920
name="DocumentResourceLink",

geonode/security/tests.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,11 @@ def test_dataset_permissions(self):
755755
bobby = get_user_model().objects.get(username="bobby")
756756

757757
self.client.force_login(get_user_model().objects.get(username="admin"))
758-
payload = {"base_file": open(f"{project_dir}/tests/fixture/valid.geojson", "rb"), "action": "upload"}
758+
payload = {
759+
"base_file": open(f"{project_dir}/tests/fixture/valid.geojson", "rb"),
760+
"action": "upload",
761+
"override_existing_layer": True,
762+
}
759763
response = self.client.post(reverse("importer_upload"), data=payload)
760764
layer = ResourceHandlerInfo.objects.filter(execution_request=response.json()["execution_id"]).first().resource
761765
if layer is None:
@@ -806,6 +810,18 @@ def test_dataset_permissions(self):
806810
self.assertTrue(b"Could not find layer" in response.content)
807811
self.assertEqual(response.headers.get("Content-Type"), "application/vnd.ogc.se_xml;charset=UTF-8")
808812

813+
# In circleCI we load some sample data via paver, but is not a mandatory action
814+
# in other cases when we dont have those layer, we have to rely on the one
815+
# we upload earlier on line 763 (same test)
816+
url = (
817+
f"{settings.GEOSERVER_LOCATION}ows?"
818+
f"LAYERS={layer.alternate}&STYLES="
819+
"&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap"
820+
"&SRS=EPSG%3A4326"
821+
"&BBOX=-81.394599749999,13.316009005566,"
822+
"-81.370560451855,13.372728455566"
823+
"&WIDTH=217&HEIGHT=512"
824+
)
809825
# test WMS with authenticated user that has access to the Dataset
810826
response = requests.get(
811827
url,

geonode/thumbs/thumbnails.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def create_thumbnail(
6262
styles: Optional[List] = None,
6363
overwrite: bool = False,
6464
background_zoom: Optional[int] = None,
65+
map_thumb_from_bbox: bool = False,
6566
) -> None:
6667
"""
6768
Function generating and saving a thumbnail of the given instance (Dataset or Map), which is composed of
@@ -111,7 +112,7 @@ def create_thumbnail(
111112

112113
if isinstance(instance, Map):
113114
is_map_with_datasets = MapLayer.objects.filter(map=instance, local=True).exclude(dataset=None).exists()
114-
if is_map_with_datasets:
115+
if is_map_with_datasets and not map_thumb_from_bbox:
115116
compute_bbox_from_datasets = True
116117
if bbox:
117118
bbox = bbox_utils.clean_bbox(bbox, target_crs)

geonode/upload/handlers/common/remote.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def is_valid_url(url, **kwargs):
9090
r.raise_for_status()
9191
except requests.exceptions.Timeout:
9292
raise ImportException("Timed out")
93-
except Exception:
93+
except Exception as e:
94+
logger.exception(e)
9495
raise ImportException("The provided URL is not reachable")
9596
return True
9697

geonode/upload/handlers/remote/wms.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def generate_resource_payload(self, layer_name, alternate, asset, _exec, workspa
157157
.encode("utf-8", "ignore")
158158
.decode("utf-8")
159159
.replace(".", "")
160-
.replace("/", ""),
160+
.replace("/", "")
161+
.replace(":", ""),
161162
ptype="gxp_wmscsource",
162163
ows_url=_exec.input_params.get("ows_url"),
163164
)

0 commit comments

Comments
 (0)