sm: don't use uri to create directories

Use the uri only for the endpoint. After that, reuse the uri
buffer to cache the base directory name.