geoserver-rest icon indicating copy to clipboard operation
geoserver-rest copied to clipboard

Passing XML to `upload_style` fails for long XML

Open JamesSample opened this issue 10 months ago • 1 comments

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! :-)

JamesSample avatar Apr 16 '24 20:04 JamesSample

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 avatar Apr 24 '24 17:04 iboates

@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.

iboates avatar Apr 28 '24 14:04 iboates

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

JamesSample avatar Apr 30 '24 07:04 JamesSample