gicait / geoserver-rest

Python library for management of geospatial data in GeoServer.
https://geoserver-rest.readthedocs.io
MIT License
191 stars 77 forks source link

Passing XML to `upload_style` fails for long XML #147

Closed JamesSample closed 3 months ago

JamesSample commented 4 months ago

I'm trying to use the functionality recently introduced in v2.7.0, where geo.upload_style can accept XML instead of an SLD file path (I think this was added about 2 months ago in this commit).

However, when passed long XML, the line here fails with

OSError: [Errno 36] File name too long

A possible solution could be to try validating the XML first?

Thanks for a very useful package! :-)

iboates commented 3 months ago

My bad. I developed and tested only in a Linux environment where there is (basically) no file path limit. Of course it fails due to the Windows file name limit of 254 characters.

I've opened a PR to fix this, like you said it's just a matter of reversing the order of the if-check

If you need an urgent fix, you can install from my branch:

pip install git+https://github.com/iboates/geoserver-rest.git@fix-long-xml-file-name-crash#egg=geoserver-rest

iboates commented 3 months ago

@JamesSample could you confirm that the fix works using the master branch? It was merged in https://github.com/gicait/geoserver-rest/pull/149

If it is then @iamtekson this issue can be closed.

JamesSample commented 3 months ago

Thanks @iboates and @iamtekson. This fixes the issue for me.