HDFGroup / hsds

Cloud-native, service based access to HDF data
https://www.hdfgroup.org/solutions/hdf-kita/
Apache License 2.0
126 stars 52 forks source link

Multilink #296

Closed jreadey closed 5 months ago

jreadey commented 5 months ago

Added post method for links and multi support for delete link

mattjala commented 5 months ago

There's a REST VOL url-encoding test with a group named url_encoding_group !*'():@&=+$,?#[]-.<>\\^`{}|~, and it fails with a 404 when trying to re-open the group here after this PR. I'll see if I can track down the exact cause.

mattjala commented 5 months ago

The issue with URL encoding is actually on the REST VOL's side. This PR fixed an issue that was obscuring it. LGTM for now. Details on the encoding issue are below.

The issue comes from backslashes in the link name. Before this PR, the link name url_encoding_group !*'():@&=+$,?#[]-.<>\^`{}|~ was erroneously truncated before the ? during both the creation of the link and the GET request to check for its existence, so the issue went unnoticed.

After this PR, the link is successfully created with the entire name. When creating the link, the name is provided as in body of a POST_Group request, and its value contains two literal backslash characters. When making the subsequent GET_Link request, the same link name string is provided as part of the destination URL, and is parsed in GET_Domain with four literal backslash characters.

I think this is because backslashes in the URL don't need to be escaped since they are (or should be) already percent-encoded, but backslashes in JSON strings do need to be escaped with another backslash. So when GET_Domain receives two backslashes characters, each is interpreted as a logical backslash character, resulting in four total literal backslashes. The issue is actually on the REST VOL's side, since it should encode strings for JSON properly

mattjala commented 5 months ago

This looks good - I'll approve once I have a build of the REST VOL working with the new responses.

mattjala commented 5 months ago

Besides my two comments, this seems good to go in - I have a draft PR to the REST VOL which works with a version of this PR that incorporates the changes I requested

jreadey commented 5 months ago

I've checked in some new code to let you return links based on a regex-like pattern. Also added a follow_links paran to GET_Links.