Skip to content

Remove leading '/' from path in session requests refs #3399942

Closes #3399942

I updated the ArchivesSpaceSession class by removing the leading '/' from the path in requests. Archivesspace allows you to configure the API at a specific path, or at least the third-party hosting service has configured our API at a specific path. Guzzle's base_uri allows you to include a path, but if the path in the request includes a leading '/' the path in the base_uri get's ignored due to Guzzles adherence to RFC 3986. If you remove the path to the base_uri, Guzzle will add the '/' between the base_uri and the path, so the leading '/' in the path isn't needed.

I was going to go through and change all paths that included a leading '/', but there's a lot and some of it's in configuration and some of them are used for regex comparisons and I believe the paths are also used as migration Id's (I think?). It felt pretty risky to try and make that update. The easiest thing seemed to be to use php's ltrim to remove the leading '/' from the path at the point of the request. Let me know if I should go back to the drawing board or if this is a bad idea altogether.

Merge request reports