Fix absolute path issue in create_datastore function#181
Fix absolute path issue in create_datastore function#181iamtekson merged 4 commits intogicait:masterfrom
Conversation
- Add use_relative_path parameter (default True) to create_datastore - Convert absolute paths to relative paths using data/workspace/filename format - Maintain backward compatibility with existing relative paths and HTTP URLs - Add test script to demonstrate path conversion functionality - Fixes issue gicait#72 where absolute paths made GeoServer non-portable The fix ensures that when use_relative_path=True (default), absolute file paths are converted to relative paths like 'data/workspace/filename.shp', making GeoServer configurations portable across different machines.
|
I agree that it is better to not modify the paths at all, but it could be a breaking change if the previous default behaviour was to convert to absolute paths, since after a package upgrade it would change. While counterintuitive, it might be safer for backwards comaptibility to make the parameter called Also, the test needs to use |
|
thank you for the feedback @iboates I will use that logic in my test cases |
|
Yes, I agree with @iboates. Either we can set |
… tests - Rename use_relative_path to force_absolute_path (default True) for backward compatibility - Update logic to use not force_absolute_path for path conversion - Add comprehensive test cases with proper assert statements - Ensure tests will fail if functionality doesn't work correctly - Maintain backward compatibility as suggested by @iboates and @iamtekson
…ub.com/maxx-mill/geoserver-rest into fix-absolute-paths-in-create-datastore Merge remote changes to sync branch .
iamtekson
left a comment
There was a problem hiding this comment.
LGTM. Thanks @maxx-mill for your contribution.
Summary
Fixes issue #72 where
create_datastore()was embedding absolute file paths into GeoServer's configuration, making the GeoServer instance non-portable across different machines.Changes
use_relative_pathparameter (defaultTrue) tocreate_datastorefunctiondata/workspace/filenameformatTechnical Details
When
use_relative_path=True(default), absolute file paths are converted to relative paths likedata/workspace/filename.shp, making GeoServer configurations portable across different machines.Testing
tests/test_path_fix.pyto demonstrate the path conversion functionalityBreaking Changes
None - this is a backward-compatible enhancement with a new optional parameter.