diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-16 14:34:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-16 14:34:54 +0100 |
| commit | 266c853e10de50ce75af8be834647fda2c5fc2a0 (patch) | |
| tree | 4ae7979dbd90f77e430118a4f97db166b063458a /django | |
| parent | d08d4f464ab11cc226d4e197c0f43e26a7fd2961 (diff) | |
Fixed #31162 -- Prevented error logs when using WKT strings in lookups.
Thanks dbxnr for the initial patch.
Regression in 6f44f714c92d2966dca390ebd3054e5fb0bb0c80.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/gdal/raster/source.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/django/contrib/gis/gdal/raster/source.py b/django/contrib/gis/gdal/raster/source.py index 05475434c4..33d8b3069f 100644 --- a/django/contrib/gis/gdal/raster/source.py +++ b/django/contrib/gis/gdal/raster/source.py @@ -73,6 +73,13 @@ class GDALRaster(GDALRasterBase): # If input is a valid file path, try setting file as source. if isinstance(ds_input, str): + if ( + not ds_input.startswith(VSI_FILESYSTEM_BASE_PATH) and + not os.path.exists(ds_input) + ): + raise GDALException( + 'Unable to read raster source input "%s".' % ds_input + ) try: # GDALOpen will auto-detect the data source type. self._ptr = capi.open_ds(force_bytes(ds_input), self._write) @@ -225,7 +232,7 @@ class GDALRaster(GDALRasterBase): @cached_property def is_vsi_based(self): - return self.name.startswith(VSI_FILESYSTEM_BASE_PATH) + return self._ptr and self.name.startswith(VSI_FILESYSTEM_BASE_PATH) @property def name(self): |
