I was running into an issue where ``.split('/')[-2]`` would return an empty string if the uri had a trailing slash. I'm not sure why the uri had one so not sure if it's a concern here or not.