GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.41k stars 1.11k forks source link

Assets: link generation #12341

Open etj opened 1 week ago

etj commented 1 week ago

According to #12226:

Note that http://server/api/v2/assets/10/link/myindex will return the same content as http://server/api/v2/assets/10/link

The current implementation will create the Asset link as http://server/api/v2/assets/10/link In the general case, the backend is quite free to decide what to return (the current and simpler implementation is to return the first file in Asset.location. This is ok in the general case, but in case where the asset data is a directory, the returned file is usually an index file. When using and index file the client usually splits the URL in BASE_PATH/INDEX_FILE, so that when the index file references a file "XYZ" the client builds the URL BASE_PATH/XYZ This means that for these Assets the link should have the file explicitly in the URL.

In the AssetHandler we may implement a method to get a link generator handler which returns the specific way to create the link. The initial implementation may have a simple registering mechanism that can be easily extended or configured in settings.